Skip to content

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

Closed
@cowtowncoder

Description

@cowtowncoder

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.

Metadata

Metadata

Assignees

Labels

2.20Issues planned at 2.20 or later

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions