Class ApiRuntimeExceptionHandler
- java.lang.Object
-
- org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler
-
- com.karafra.bitchutedl.exceptions.handlers.ApiRuntimeExceptionHandler
-
@ControllerAdvice @Order(2147483647) public class ApiRuntimeExceptionHandler extends org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandlerGlobal exception handler for API, returning JSON instead of plain text. Thisadvicecan be overwritten at controller level as it has lowestprecedence.- Since:
- 1.0
- Version:
- 1.0
- Author:
- Karafra
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description classApiRuntimeExceptionHandler.JsonErrorResponsePrivate class representing runtime exception, will not be used anywhere else.
-
Constructor Summary
Constructors Constructor Description ApiRuntimeExceptionHandler()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.springframework.http.ResponseEntity<ApiRuntimeExceptionHandler.JsonErrorResponse>handleRuntimeException(ApiRuntimeException ex, org.springframework.web.context.request.ServletWebRequest req)Method that handles runtime exceptions.-
Methods inherited from class org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler
handleAsyncRequestTimeoutException, handleBindException, handleConversionNotSupported, handleException, handleExceptionInternal, handleHttpMediaTypeNotAcceptable, handleHttpMediaTypeNotSupported, handleHttpMessageNotReadable, handleHttpMessageNotWritable, handleHttpRequestMethodNotSupported, handleMethodArgumentNotValid, handleMissingPathVariable, handleMissingServletRequestParameter, handleMissingServletRequestPart, handleNoHandlerFoundException, handleServletRequestBindingException, handleTypeMismatch
-
-
-
-
Method Detail
-
handleRuntimeException
@ExceptionHandler(ApiRuntimeException.class) public org.springframework.http.ResponseEntity<ApiRuntimeExceptionHandler.JsonErrorResponse> handleRuntimeException(ApiRuntimeException ex, org.springframework.web.context.request.ServletWebRequest req)
Method that handles runtime exceptions.- Parameters:
ex- exception to be handledreq-requestduring processing of which RE occurred- Since:
- 1.0
-
-