Skip to content

Add RestException with additional error code and automatically convert t...#4

Merged
Ewen Cheslack-Postava (ewencp) merged 2 commits intomasterfrom
rest-exceptions
Jan 14, 2015
Merged

Add RestException with additional error code and automatically convert t...#4
Ewen Cheslack-Postava (ewencp) merged 2 commits intomasterfrom
rest-exceptions

Conversation

@ewencp
Copy link
Copy Markdown
Contributor

...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.

…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.
@ewencp
Copy link
Copy Markdown
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.

@nehanarkhede
Copy link
Copy Markdown
Contributor

Ewen Cheslack-Postava (@ewencp) Took a quick look. I'm a +1 on prefixing with Rest to make the distinction clearer.

@junrao
Copy link
Copy Markdown

+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.
@ewencp Ewen Cheslack-Postava (ewencp) deleted the rest-exceptions branch January 14, 2015 21:42
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Provide exception that is automatically converted into standard ErrorMessage response with custom, application-specific error code

3 participants