Reputation: 117
I am using the following code to send Error message.
This is my own error code and custom message. I am sending the message in response.
throw new WebApplicationException(
Response.status(1002)
.header(ae.getMessage(), ae)
.type(MediaType.TEXT_PLAIN)
.build());
The problem is, the front end guys are able to see the status code but not the message. Is there any other way to solve this issue?
Upvotes: 1
Views: 1679
Reputation: 1171
You should use entity method to set message:
Response.status(1002)
.entity(ae.getMessage())
.type(MediaType.TEXT_PLAIN)
.build());
Upvotes: 2