Add RestException with additional error code and automatically convert t...#4
Merged
Ewen Cheslack-Postava (ewencp) merged 2 commits intomasterfrom Jan 14, 2015
Merged
Conversation
…t to ErrorMessage. Add the RestException class to represent any errors that should be automatically converted to an ErrorMessage and set the specified HTTP status code. This is a subclass of WebApplicationExceptionMapper so it integrates well with the rest of Jersey. WebApplicationExceptionMapper is updated to handle this special case, using different values for the HTTP status and error code embedded in the response entity. This also adds a couple of subclasses for common HTTP statuses. Fixes #3.
Contributor
Author
|
Jun Rao (@junrao) This is the functionality we discussed for providing finer-grained numeric error codes in error responses. One thing I'd like a second opinion on is whether the naming of the common variants (e.g. NotFoundException) is going to be too confusing and/or error prone since they are identical to the ones in JAX-RS. One alternative would be to prefix them with Rest to make the difference clear. |
This was referenced Jan 8, 2015
Contributor
|
Ewen Cheslack-Postava (@ewencp) Took a quick look. I'm a +1 on prefixing with Rest to make the distinction clearer. |
…ApplicationException types.
|
+1 on the patch. |
Ewen Cheslack-Postava (ewencp)
added a commit
that referenced
this pull request
Jan 14, 2015
Add RestException with additional error code and automatically convert to ErrorMessage.
mapr-devops (mapr-devops)
pushed a commit
to mapr/rest-utils
that referenced
this pull request
Aug 23, 2025
…confluentinc#4) Co-authored-by: Prince Raheja <114437476+rahejaprince@users.noreply.github.com> Co-authored-by: ConfluentSemaphore <40306929+ConfluentSemaphore@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
...o ErrorMessage.
Add the RestException class to represent any errors that should be automatically
converted to an ErrorMessage and set the specified HTTP status code. This is a
subclass of WebApplicationExceptionMapper so it integrates well with the rest of
Jersey. WebApplicationExceptionMapper is updated to handle this special case,
using different values for the HTTP status and error code embedded in the
response entity. This also adds a couple of subclasses for common HTTP
statuses. Fixes #3.