Groups
Groups
Sign in
Groups
Groups
RestExpress
Conversations
About
Send feedback
Help
How to return an exception in the result
27 views
Skip to first unread message
chunding xie
unread,
Aug 1, 2016, 4:26:15 AM
8/1/16
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to RestExpress
How to return an exception in the result
Todd Fredrich
unread,
Aug 3, 2016, 4:07:57 PM
8/3/16
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to RestExpress
Just throwing an exception will return an error in the result.
Throw one of these exceptions to return the corresponding HTTP status code:
https://github.com/RestExpress/RestExpress/tree/master/core/src/main/java/org/restexpress/exception
Or extend ServiceException and set your own HTTP status in it.
If you want to change the format of what gets returned in the error response, implement ResponseWrapper (
https://github.com/RestExpress/RestExpress/blob/master/core/src/main/java/org/restexpress/response/ResponseWrapper.java
) --there are some examples in that package-- and use it in your SerializationProvider implementation.
Reply all
Reply to author
Forward
0 new messages