alimate/errors-spring-boot-starter

Investigating the Possibility of Supporting Multiple Refiners

alimate opened this issue · 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.