Skip to content
Snippets Groups Projects
Commit 411a33e4 authored by Tor-Einar Skog's avatar Tor-Einar Skog
Browse files

More sensible error handling

parent 7e8d3ace
No related branches found
No related tags found
No related merge requests found
......@@ -323,11 +323,13 @@ public class ManagerResourceImpl implements ManagerResource{
// We forward both the status code and the Exception
if(! resp.getStatusInfo().equals(Response.Status.OK))
{
// Deserialize the exception
Exception ex = resp.readEntity(Exception.class);
log.setMessage(ex.getMessage());
// Deserialize the exception into string
String res = resp.readEntity(String.class);
// Log it
log.setMessage(res.substring(0,2047));
ControllerGetter.getUserController().storeModelUsageLog(log);
throw new WebApplicationException(Response.status(resp.getStatus()).entity(ex).build());
// Send exception
throw new WebApplicationException(Response.status(resp.getStatus()).entity(res).build());
}
else
{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment