Inconsistent Exception Handling Between WebMVC and WebFlux #32689
Labels
in: web
Issues in web modules (web, webmvc, webflux, websocket)
status: waiting-for-triage
An issue we've not yet triaged or decided on
I am customizing HandlerFunction:
For web MVC:
For web Flux:
I expect that the ResponseStatusException should be handled by
ResponseEntityExceptionHandler
(when settingspring.{mvc,webflux}.problemdetails.enabled
to true), but the result is that the exception in ReactiveHandlerFunction can be handled, while the one in ServletHandlerFunction cannot. The reason is found here (org.springframework.web.servlet.mvc.method.annotation.ExceptionHandlerExceptionResolver#shouldApplyTo
), where exceptions thrown from HandlerFunction are not processed.This is somewhat frustrating, especially when developing frameworks. I hope that both webmvc and webflux can have the same behavior for exception handling. It would be really helpful if
ExceptionHandlerExceptionResolver
could handleResponseStatusException
thrown by HandlerFunction.The text was updated successfully, but these errors were encountered: