Skip to content

Instantly share code, notes, and snippets.

@samuelcatalano-zz
Last active November 28, 2018 19:41
Show Gist options
  • Save samuelcatalano-zz/085dd8b97619faf2eb6b1cd3b58644e2 to your computer and use it in GitHub Desktop.
Save samuelcatalano-zz/085dd8b97619faf2eb6b1cd3b58644e2 to your computer and use it in GitHub Desktop.
Returning message error using javax.ws.rs.core.Response
//javax.ws.rs.core.Response return message error
// catch Expection
JsonObject error = new JsonObject();
error.put("erro", e.getMessage());
return Response.status(HttpStatus.SC_BAD_REQUEST).entity(error.toString()).type(MediaType.APPLICATION_JSON).build();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment