public class SpringValidationWebErrorHandler extends Object implements WebErrorHandler
WebErrorHandler responsible for handling validation errors thrown by
the web layer. Currently, the following exceptions are supported:
BindExceptionMethodArgumentNotValidException| Constructor and Description |
|---|
SpringValidationWebErrorHandler() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
canHandle(Throwable exception)
Can only handle supported exceptions mentioned above.
|
HandledException |
handle(Throwable exception)
After extracting the
BindingResult from the exception, would iterate over all errors and
pack all validation errors with their corresponding to be exposed arguments. |
public boolean canHandle(Throwable exception)
canHandle in interface WebErrorHandlerexception - The exception to examine.true if it can handle the exception, false otherwise.@NonNull public HandledException handle(Throwable exception)
BindingResult from the exception, would iterate over all errors and
pack all validation errors with their corresponding to be exposed arguments.handle in interface WebErrorHandlerexception - The exception to handle.HandledException instance containing the required details about the validation errors.Copyright © 2018. All rights reserved.