@RestControllerAdvice public abstract class ErrorsControllerAdvice extends Object
WebErrorHandlers assistance.| Constructor and Description |
|---|
ErrorsControllerAdvice(WebErrorHandlers errorHandlers,
HttpErrorAttributesAdapter httpErrorAttributesAdapter)
Initializing the rest controller advice by injecting the
WebErrorHandlers bean. |
| Modifier and Type | Method and Description |
|---|---|
org.springframework.http.ResponseEntity<?> |
handleException(Throwable exception,
Locale locale)
Catches any exception and converts it to a HTTP response with appropriate status
code and error code-message combinations.
|
public ErrorsControllerAdvice(WebErrorHandlers errorHandlers, HttpErrorAttributesAdapter httpErrorAttributesAdapter)
WebErrorHandlers bean.errorHandlers - The exception handler collaborator.httpErrorAttributesAdapter - To adapt our error representation to Spring Boot's representation of an error.NullPointerException - When one of the required parameters are null.@ExceptionHandler public org.springframework.http.ResponseEntity<?> handleException(Throwable exception, Locale locale)
exception - The caught exception.locale - Determines the locale for message translation.Copyright © 2018. All rights reserved.