Skip to content

Commit

Permalink
Update error message (#101)
Browse files Browse the repository at this point in the history
  • Loading branch information
ruhan1 authored Jul 18, 2024
1 parent d7cee17 commit 6834024
Showing 1 changed file with 12 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,22 @@ public RuntimeException toThrowable(Response response)
if (response.getStatus() == 500)
{
Object entity = response.getEntity();
if (entity instanceof InputStream)
if (entity != null)
{
try (InputStream is = (InputStream) entity)
if (entity instanceof InputStream)
{
throw new WebApplicationException(IOUtils.toString(is, Charset.defaultCharset()));
try (InputStream is = (InputStream) entity)
{
throw new WebApplicationException(IOUtils.toString(is, Charset.defaultCharset()));
}
catch (IOException e)
{
throw new WebApplicationException("Unknown error, " + e.getMessage());
}
}
catch (IOException e)
else
{
throw new WebApplicationException("Unknown error");
throw new WebApplicationException(entity.toString());
}
}
throw new WebApplicationException("Unknown error");
Expand Down

0 comments on commit 6834024

Please sign in to comment.