@ControllerAdvice public class GlobalExceptionHandler extends Object
| 构造器和说明 |
|---|
GlobalExceptionHandler() |
| 限定符和类型 | 方法和说明 |
|---|---|
BaseResponse |
argumentNotValidErrorHandler(org.springframework.web.bind.MethodArgumentNotValidException e)
parameter invalid exception
|
BaseResponse |
bindErrorHandler(javax.servlet.http.HttpServletRequest req,
org.springframework.validation.BindException e)
parameter binding exception
|
BaseResponse |
customErrorHandler(javax.servlet.http.HttpServletRequest req,
top.beanshell.common.exception.BaseException e)
custom exception
|
BaseResponse |
defaultErrorHandler(javax.servlet.http.HttpServletRequest req,
Exception e)
unknown error,ex:500
|
BaseResponse |
notFoundErrorHandler(javax.servlet.http.HttpServletRequest req,
org.springframework.web.servlet.NoHandlerFoundException e)
api not found 404
|
BaseResponse |
requestMethodNotSupportedErrorHandler(org.springframework.web.HttpRequestMethodNotSupportedException e)
request method unsupport exception
|
@ExceptionHandler(value=java.lang.Exception.class) @ResponseBody public BaseResponse defaultErrorHandler(javax.servlet.http.HttpServletRequest req, Exception e) throws Exception
req - servlet requeste - exceptionException - any runtime exception@ExceptionHandler(value=org.springframework.web.servlet.NoHandlerFoundException.class) @ResponseBody public BaseResponse notFoundErrorHandler(javax.servlet.http.HttpServletRequest req, org.springframework.web.servlet.NoHandlerFoundException e)
req - servlet requeste - exception@ExceptionHandler(value=org.springframework.validation.BindException.class) @ResponseBody public BaseResponse bindErrorHandler(javax.servlet.http.HttpServletRequest req, org.springframework.validation.BindException e)
req - servlet requeste - exception@ExceptionHandler(value=org.springframework.web.bind.MethodArgumentNotValidException.class) @ResponseBody public BaseResponse argumentNotValidErrorHandler(org.springframework.web.bind.MethodArgumentNotValidException e)
e - exception@ExceptionHandler(value=top.beanshell.common.exception.BaseException.class) @ResponseBody public BaseResponse customErrorHandler(javax.servlet.http.HttpServletRequest req, top.beanshell.common.exception.BaseException e)
req - servlet requeste - exception@ExceptionHandler(value=org.springframework.web.HttpRequestMethodNotSupportedException.class) @ResponseBody public BaseResponse requestMethodNotSupportedErrorHandler(org.springframework.web.HttpRequestMethodNotSupportedException e)
e - exceptionCopyright © 2021. All rights reserved.