全局异常参数错误提示优化:业务异常中系统错误增加堆栈输出

This commit is contained in:
gaoqr
2025-04-08 14:04:58 +08:00
parent 00de7af507
commit d8ddb52fbb
2 changed files with 12 additions and 2 deletions
@@ -77,7 +77,12 @@ public class GlobalExceptionHandler implements ErrorWebExceptionHandler {
@ExceptionHandler(value = ServiceException.class)
public CommonResult serviceExceptionHandler(ServiceException ex) {
log.info(String.format("========[serviceExceptionHandler]========%s: %s", ex.getCode(),ex.getMessage()));
// 系统异常输出堆栈
if(INTERNAL_SERVER_ERROR.getCode().equals(ex.getCode())) {
log.info("[serviceExceptionHandler]", ex);
} else {
log.info(String.format("==========[serviceExceptionHandler]==========%s%s", ex.getCode(), ex.getMessage()));
}
return CommonResult.error(ex.getCode(), ex.getMessage());
}