errors-spring-boot-starter icon indicating copy to clipboard operation
errors-spring-boot-starter copied to clipboard

Investigating the Possibility of Supporting Multiple Refiners

Open alimate opened this issue 5 years ago • 0 comments

Synopsis

Currently, one can only register at most one ExceptionRefiner instance to refine exceptions before processing them. That might be useful to extend this feature in a way that it supports multiple refiners.

Possible Use Cases

It's a common pattern to wrap some exceptions into other exceptions which are more appropriate to a particular abstraction level. For example, when Jackson fails to de-serialize a byte-array into a POJO, the thrown exception will be wrapped inside a Spring exception. The only way for us to handle those Jackson exceptions is to:

  1. Provide a built-in refiner to translate the Spring exception into the Jackson exception.
  2. And then handle that Jackson exception using another built-in WebErrorHandler.

alimate avatar Apr 19 '19 10:04 alimate