@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,
org.springframework.web.context.request.WebRequest webRequest,
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, org.springframework.web.context.request.WebRequest webRequest, Locale locale)
exception - The caught exception.webRequest - The current HTTP request.locale - Determines the locale for message translation.Copyright © 2019. All rights reserved.