@RestControllerAdvice public class ErrorControllerAdvice extends Object
ErrorResponse
for a particular controller and/or
exception type.Constructor and Description |
---|
ErrorControllerAdvice() |
Modifier and Type | Method and Description |
---|---|
ErrorResponse |
handleControllerException(javax.servlet.http.HttpServletRequest req,
Throwable ex)
An exception handler method for
IllegalArgumentException thrown from all the Rest
controllers. |
org.springframework.http.ResponseEntity<?> |
handleIOException(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res,
KeywhizException ex)
An exception handler method for
KeywhizException thrown from all the Rest controllers. |
@ExceptionHandler(value=java.lang.IllegalArgumentException.class) @ResponseStatus(value=BAD_REQUEST) public ErrorResponse handleControllerException(javax.servlet.http.HttpServletRequest req, Throwable ex)
IllegalArgumentException
thrown from all the Rest
controllers.req
- http request.ex
- exception thrown.ErrorResponse
@ExceptionHandler(value=KeywhizException.class) public org.springframework.http.ResponseEntity<?> handleIOException(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res, KeywhizException ex)
KeywhizException
thrown from all the Rest controllers.req
- Http request.res
- Http Response.ex
- exception thrown.ErrorResponse
Copyright © 2018 Walmart, Inc.. All rights reserved.