Skip to content

Add new exception type, MissingInjectValueException, to be used for failed @JacksonInject #5151

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

Closed
cowtowncoder opened this issue May 10, 2025 · 0 comments
Assignees
Labels
2.20 Issues planned at 2.20 or later

Comments

@cowtowncoder
Copy link
Member

Before 2.20, missing value for @JacksonInject is indicated by one of:

  • InvalidDefinitionException if no injectable values configured
  • IllegalArgumentException if no matching value is found form configured ones

With fix for #3072 things are being improved (see #5131) but exception types remain as above.
Neither is right:

  1. IllegalArgumentException is highly unexpected, not being a JacksonException (of JsonMappingException subtype) ( Part of databind#3072: Make @JacksonInject not fail when there's no corresponding value #5131 will change this)
  2. InvalidDefinitionException is incorrect since it is not (necessarily) a bad class definition but more likely mismatch between values

So to correctly indicate actual reason, let's create something like MissingInjectValueException to indicate exact nature of failure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.20 Issues planned at 2.20 or later
Projects
None yet
Development

No branches or pull requests

1 participant