@ControllerAdvice @ConditionalOnWebApplication public class HoneyExceptionDefaultHandler extends Object implements HoneyExceptionHandler
| Constructor and Description |
|---|
HoneyExceptionDefaultHandler() |
| Modifier and Type | Method and Description |
|---|---|
HoneyErrorResponse |
handleBaseException(HoneyBaseException e)
自定义异常
|
HoneyErrorResponse |
handleBindException(org.springframework.validation.BindException e)
参数绑定异常
|
HoneyErrorResponse |
handleBusinessException(HoneyBaseException e)
业务异常
|
HoneyErrorResponse |
handleException(Exception e)
未定义异常
|
HoneyErrorResponse |
handleServletException(Exception e)
Controller上一层相关异常
|
HoneyErrorResponse |
handleValidException(org.springframework.web.bind.MethodArgumentNotValidException e)
参数校验异常,将校验失败的所有异常组合成一条错误信息
|
@ExceptionHandler(value=HoneyBusinessException.class) @ResponseBody public HoneyErrorResponse handleBusinessException(HoneyBaseException e)
handleBusinessException in interface HoneyExceptionHandlere - 异常@ExceptionHandler(value=HoneyBaseException.class) @ResponseBody public HoneyErrorResponse handleBaseException(HoneyBaseException e)
handleBaseException in interface HoneyExceptionHandlere - 异常@ExceptionHandler(value={org.springframework.web.servlet.NoHandlerFoundException.class,org.springframework.web.HttpRequestMethodNotSupportedException.class,org.springframework.web.HttpMediaTypeNotSupportedException.class,org.springframework.web.bind.MissingPathVariableException.class,org.springframework.web.bind.MissingServletRequestParameterException.class,org.springframework.beans.TypeMismatchException.class,org.springframework.http.converter.HttpMessageNotReadableException.class,org.springframework.http.converter.HttpMessageNotWritableException.class,org.springframework.web.HttpMediaTypeNotAcceptableException.class,org.springframework.web.bind.ServletRequestBindingException.class,org.springframework.beans.ConversionNotSupportedException.class,org.springframework.web.multipart.support.MissingServletRequestPartException.class,org.springframework.web.context.request.async.AsyncRequestTimeoutException.class})
@ResponseBody
public HoneyErrorResponse handleServletException(Exception e)
handleServletException in interface HoneyExceptionHandlere - 异常@ExceptionHandler(value=org.springframework.validation.BindException.class) @ResponseBody public HoneyErrorResponse handleBindException(org.springframework.validation.BindException e)
handleBindException in interface HoneyExceptionHandlere - 异常@ExceptionHandler(value=org.springframework.web.bind.MethodArgumentNotValidException.class) @ResponseBody public HoneyErrorResponse handleValidException(org.springframework.web.bind.MethodArgumentNotValidException e)
handleValidException in interface HoneyExceptionHandlere - 异常@ExceptionHandler(value=java.lang.Exception.class) @ResponseBody public HoneyErrorResponse handleException(Exception e)
handleException in interface HoneyExceptionHandlere - 异常Copyright © 2021. All rights reserved.