@@ -1168,19 +1168,17 @@ as a `HandlerResult`, along with some additional context, and passed to the firs
1168
1168
=== Exceptions
1169
1169
[.small]#<<web.adoc#mvc-exceptionhandlers, Web MVC>>#
1170
1170
1171
- The `HandlerResult` returned from a `HandlerAdapter` can expose a function for error
1172
- handling based on some handler-specific mechanism. This error function is called if:
1171
+ `HandlerAdapter` implementations can handle internally exceptions from invoking a request
1172
+ handler, such as a controller method. However, an exception may be deferred if the request
1173
+ handler returns an asynchronous value.
1173
1174
1174
- * The handler (for example, `@Controller`) invocation fails.
1175
- * The handling of the handler return value through a `HandlerResultHandler` fails.
1175
+ A `HandlerAdapter` may expose its exception handling mechanism as a
1176
+ `DispatchExceptionHandler` set on the `HandlerResult` it returns. When that's set,
1177
+ `DispatcherHandler` will also apply it to the handling of the result.
1176
1178
1177
- The error function can change the response (for example, to an error status), as long as an error
1178
- signal occurs before the reactive type returned from the handler produces any data items.
1179
-
1180
- This is how `@ExceptionHandler` methods in `@Controller` classes are supported.
1181
- By contrast, support for the same in Spring MVC is built on a `HandlerExceptionResolver`.
1182
- This generally should not matter. However, keep in mind that, in WebFlux, you cannot use a
1183
- `@ControllerAdvice` to handle exceptions that occur before a handler is chosen.
1179
+ A `HandlerAdapter` may also choose to implement `DispatchExceptionHandler`. Inn that case
1180
+ `DispatcherHandler` will apply it to exceptions that arise before a handler is mapped,
1181
+ e.g. during handler mapping, or earlier, e.g. in a `WebFilter`.
1184
1182
1185
1183
See also <<webflux-ann-controller-exceptions>> in the "`Annotated Controller`" section or
1186
1184
<<webflux-exception-handler>> in the WebHandler API section.
0 commit comments