类 GlobalExceptionHandler
java.lang.Object
io.github.lishangbu.orange.web.exception.GlobalExceptionHandler
- 从以下版本开始:
- 2018/8/30 全局异常处理器
- 作者:
- lishangbu
- 
构造器概要构造器
- 
方法概要修饰符和类型方法说明handleBodyValidException(org.springframework.web.bind.MethodArgumentNotValidException exception) BindException全局异常.handleHttpMessageNotWritableException(org.springframework.http.converter.HttpMessageNotWritableException e) 运行时异常.handleHttpRequestMethodNotSupportedExceptionn(org.springframework.web.HttpRequestMethodNotSupportedException exception) 处理业务校验过程中碰到的非法参数异常 该异常基本由Assert抛出handleIllegalStateException(IllegalStateException exception) 处理非法状态handleNoResourceFoundException(org.springframework.web.servlet.resource.NoResourceFoundException exception) 处理资源不存在运行时异常.handleSQLException(SQLException exception) 处理SQL异常不支持的操作类型
- 
构造器详细资料- 
GlobalExceptionHandlerpublic GlobalExceptionHandler()
 
- 
- 
方法详细资料- 
handleGlobalException
- 
handleRuntimeException@ExceptionHandler(RuntimeException.class) @ResponseStatus(INTERNAL_SERVER_ERROR) public ApiResult<Void> handleRuntimeException(RuntimeException e) 运行时异常.- 参数:
- e- the e
- 返回:
- ResultBean
 
- 
handleHttpMessageNotWritableException
- 
handleBodyValidException@ExceptionHandler({org.springframework.web.bind.MethodArgumentNotValidException.class,org.springframework.validation.BindException.class}) @ResponseStatus(BAD_REQUEST) public ApiResult<Void> handleBodyValidException(org.springframework.web.bind.MethodArgumentNotValidException exception) BindException- 参数:
- exception- 参数绑定错误
- 返回:
- ResultBean
 
- 
handleIllegalArgumentException@ExceptionHandler(IllegalArgumentException.class) @ResponseStatus(INTERNAL_SERVER_ERROR) public ApiResult<Void> handleIllegalArgumentException(IllegalArgumentException exception) 处理业务校验过程中碰到的非法参数异常 该异常基本由Assert抛出- 参数:
- exception- 参数校验异常
- 返回:
- API返回结果对象包装后的错误输出结果
- 另请参阅:
 
- 
handleIllegalStateException@ExceptionHandler(IllegalStateException.class) @ResponseStatus(INTERNAL_SERVER_ERROR) public ApiResult<Void> handleIllegalStateException(IllegalStateException exception) 处理非法状态- 参数:
- exception-
- 返回:
 
- 
handleSQLException@ExceptionHandler(SQLException.class) @ResponseStatus(INTERNAL_SERVER_ERROR) public ApiResult<Void> handleSQLException(SQLException exception) 处理SQL异常- 参数:
- exception-
- 返回:
 
- 
handleUnsupportedOperationException@ExceptionHandler(UnsupportedOperationException.class) @ResponseStatus(INTERNAL_SERVER_ERROR) public ApiResult<Void> handleUnsupportedOperationException(UnsupportedOperationException exception) 不支持的操作类型- 参数:
- exception-
- 返回:
 
- 
handleNoResourceFoundException
- 
handleHttpRequestMethodNotSupportedExceptionn
 
-