修改 Dubbo Exception Filter 的处理,针对系统异常,还是直接抛出

This commit is contained in:
YunaiV
2020-07-19 03:55:44 +08:00
parent c0407267b9
commit e04c9584e3
2 changed files with 21 additions and 20 deletions

View File

@@ -160,9 +160,15 @@ public class GlobalExceptionHandler {
*/
@ExceptionHandler(value = GlobalException.class)
public CommonResult globalExceptionHandler(HttpServletRequest req, GlobalException ex) {
logger.error("[globalExceptionHandler]", ex);
// 插入异常日志
this.createExceptionLog(req, ex);
// 系统异常时,才打印异常日志
if (INTERNAL_SERVER_ERROR.getCode().equals(ex.getCode())) {
logger.error("[globalExceptionHandler]", ex);
// 插入异常日志
this.createExceptionLog(req, ex);
// 普通全局异常,打印 info 日志即可
} else {
logger.info("[globalExceptionHandler]", ex);
}
// 返回 ERROR CommonResult
return CommonResult.error(ex);
}