Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Deal better with 404s returned by the server
  • Loading branch information
egonw committed Nov 6, 2011
1 parent 32af568 commit 3cc926b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
Expand Up @@ -76,6 +76,10 @@ protected List<? extends ITestResult> doRunTest(ICDKMolecule cdkmol,
logger.error(" == Opentox model without access: " + model);
String errorMessage = "No access: " + e.getMessage().toLowerCase();
return returnError(errorMessage, errorMessage);
} catch (UnsupportedOperationException e) {
logger.error(" == Opentox model unavailable: " + model);
String errorMessage = "Unavailable service: " + e.getMessage().toLowerCase();
return returnError(errorMessage, errorMessage);
}catch(Exception e){
logger.error(" == Opentox model calculation failed for: " + model);
logger.debug(e);
Expand Down
Expand Up @@ -87,7 +87,11 @@ public static String calculate(String service, String model,
throw new GeneralSecurityException("Not authenticated");
} else if (status == 403) {
throw new GeneralSecurityException("Not authorized");
} else if (status == 404) {
logger.debug("Model not found (404): " + responseString);
throw new UnsupportedOperationException("Service not found");
} else {
logger.debug("Model error (" + status + "): " + responseString);
throw new IllegalStateException("Service error: " + status);
}
method.releaseConnection();
Expand Down

0 comments on commit 3cc926b

Please sign in to comment.