@RestControllerAdvice // 针对所有的RestController添加了AOP
public class BaseExceptionHandler {
// 指定捕获什么类型的异常
@ExceptionHandler(value = Exception.class)
public ResponseResult handleException(Exception e) {
e.printStackTrace();
log.error(e.getMessage());
return ResponseResult.errorResult(AppHttpCodeEnum.SERVER_ERROR);
}
}
标签:Exception,ResponseResult,public,处理器,全局,异常,class
From: https://www.cnblogs.com/daskache/p/16758425.html