Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -44,19 +44,34 @@ public RuntimeException toThrowable(Response response)
{
try (InputStream is = (InputStream) entity)
{
throw new WebApplicationException(IOUtils.toString(is, Charset.defaultCharset()));
String errorBody = IOUtils.toString(is, Charset.defaultCharset());
throw new WebApplicationException(
String.format("HTTP 500 error from service: %s", errorBody),
response.getStatus()
);
}
catch (IOException e)
{
throw new WebApplicationException("Unknown error, " + e.getMessage());
throw new WebApplicationException(
String.format("HTTP 500 error from service (failed to read response body: %s). Headers: %s",
e.getMessage(), response.getHeaders()),
response.getStatus()
);
}
}
else
{
throw new WebApplicationException(entity.toString());
throw new WebApplicationException(
String.format("HTTP 500 error from service: %s", entity.toString()),
response.getStatus()
);
}
}
throw new WebApplicationException("Unknown error");
throw new WebApplicationException(
String.format("HTTP 500 error from service with no response body. Headers: %s, Status Info: %s",
response.getHeaders(), response.getStatusInfo()),
response.getStatus()
);
}
return null;
}
Expand Down
Loading