@ControllerAdvice(basePackages="com.dsg.category.controller")
public class GlobalExceptionController
extends org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler
Modifier and Type | Field and Description |
---|---|
ResponseGenerator |
generator
The generator.
|
Constructor and Description |
---|
GlobalExceptionController() |
Modifier and Type | Method and Description |
---|---|
org.springframework.http.ResponseEntity<ResponseData> |
customExceptionHandler(CustomException ex)
Custom exception handler.
|
org.springframework.http.ResponseEntity<ResponseData> |
exceptionHandler(Exception ex)
This method will execute for exceptions that are not handled and return error
response in JSON format.
|
handleAsyncRequestTimeoutException, handleBindException, handleConversionNotSupported, handleException, handleExceptionInternal, handleHttpMediaTypeNotAcceptable, handleHttpMediaTypeNotSupported, handleHttpMessageNotReadable, handleHttpMessageNotWritable, handleHttpRequestMethodNotSupported, handleMethodArgumentNotValid, handleMissingPathVariable, handleMissingServletRequestParameter, handleMissingServletRequestPart, handleNoHandlerFoundException, handleServletRequestBindingException, handleTypeMismatch
@Autowired public ResponseGenerator generator
@ExceptionHandler(value=java.lang.Exception.class) public org.springframework.http.ResponseEntity<ResponseData> exceptionHandler(Exception ex)
ex
- the ex@ExceptionHandler(value=CustomException.class) public org.springframework.http.ResponseEntity<ResponseData> customExceptionHandler(CustomException ex)
ex
- the exCopyright © 2021. All rights reserved.