Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re-organize internals of StandardExceptionMappers#register(ServerFactory, Environment) #481

Closed
sleberknight opened this issue Apr 30, 2024 · 0 comments · Fixed by #489
Closed
Assignees
Labels
code cleanup Fix issues reported by Sonar or any other code analysis tools
Milestone

Comments

@sleberknight
Copy link
Member

Since we originally added the register method, Dropwizard added more ExceptionMapper implementations, for example IllegalStateExceptionMapper. It has also removed other ones, for example it replaced the original ConstraintViolationExceptionMapper in 1.0.0-rc1 with JerseyViolationExceptionMapper.

Since we began using Dropwizard at 0.7.0, these changes have made the internal code comments and organization in register somewhat incorrect.

This method should be re-organized and comments updated so that it first disables Dropwizard default exception mappers, then registers the kiwi exception mappers, and finally registers the replacements for the Dropwizard exception mappers. There is still some overlap since kiwi contains an IllegalStateExceptionMapper which, when registered, will replace the Dropwizard ones.

And last, there are some newer Dropwizard exception mappers for which neither kiwi nor dropwizard-service-utilities contains a replacement, for example EmptyOptionalNoContentExceptionMapper in dropwizard-jersey and LoggingSQLExceptionMapper, LoggingJdbiExceptionMapper which live in dropwizard-jdbi3.

The javadocs should provide a reference (via @link or @see or both) to Dropwizard's ExceptionMapperBinder class where it registers its default mappers. The docs should also reference Overriding Default Exception Mappers so the reader (and that includes me) can quickly figure out what is registered by us and by Dropwizard.

@sleberknight sleberknight added the code cleanup Fix issues reported by Sonar or any other code analysis tools label Apr 30, 2024
@sleberknight sleberknight added this to the 3.6.0 milestone Apr 30, 2024
@sleberknight sleberknight self-assigned this Apr 30, 2024
sleberknight added a commit that referenced this issue May 1, 2024
* Add overloaded registerReplacementDropwizardExceptionMappers
  methods to StandardExceptionMappers; one accepts a Dropwizard
  Environment, the other a JerseyEnvironment
* Update/enhance javadocs with more references

Closes #481
sleberknight added a commit that referenced this issue May 1, 2024
* Add overloaded registerReplacementDropwizardExceptionMappers
  methods to StandardExceptionMappers; one accepts a Dropwizard
  Environment, the other a JerseyEnvironment
* Update/enhance javadocs with more references

Closes #481
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code cleanup Fix issues reported by Sonar or any other code analysis tools
Projects
None yet
1 participant