@RestControllerAdvice public class GlobalExceptionHandler extends Object
| 限定符和类型 | 字段和说明 |
|---|---|
private Boolean |
consoleError
是否输出异常信息
|
| 构造器和说明 |
|---|
GlobalExceptionHandler() |
| 限定符和类型 | 方法和说明 |
|---|---|
ResultResp<String> |
bindException(org.springframework.validation.BindException ex)
SpringMVC参数绑定,Validator校验不正确
|
private void |
consoleErrorMsg(Exception ex)
输出异常信息
|
ResultResp<String> |
handleException(BusinessException ex)
处理自定义异常
|
ResultResp<String> |
handleException(Exception ex) |
@Value(value="${fast.framework.consoleError:false}")
private Boolean consoleError
public GlobalExceptionHandler()
@ExceptionHandler(value=BusinessException.class) public ResultResp<String> handleException(BusinessException ex)
@ExceptionHandler(value=org.springframework.validation.BindException.class) public ResultResp<String> bindException(org.springframework.validation.BindException ex)
@ExceptionHandler(value=java.lang.Exception.class) public ResultResp<String> handleException(Exception ex)
private void consoleErrorMsg(Exception ex)
ex - Copyright © 2023. All rights reserved.