Merge branch 'master-jdk17' of https://gitee.com/zhijiantianya/yudao-cloud
commit
3d29a981f7
|
@ -205,9 +205,11 @@ public class GlobalExceptionHandler {
|
||||||
*/
|
*/
|
||||||
@ExceptionHandler(value = ServiceException.class)
|
@ExceptionHandler(value = ServiceException.class)
|
||||||
public CommonResult<?> serviceExceptionHandler(ServiceException ex) {
|
public CommonResult<?> serviceExceptionHandler(ServiceException ex) {
|
||||||
|
// 不包含的时候,才进行打印,避免 ex 堆栈过多
|
||||||
if (!IGNORE_ERROR_MESSAGES.contains(ex.getMessage())) {
|
if (!IGNORE_ERROR_MESSAGES.contains(ex.getMessage())) {
|
||||||
// 不包含的时候,才进行打印,避免 ex 堆栈过多
|
// 即使打印,也只打印第一层 StackTraceElement,并且使用 warn 在控制台输出,更容易看到
|
||||||
log.info("[serviceExceptionHandler]", ex);
|
StackTraceElement[] stackTrace = ex.getStackTrace();
|
||||||
|
log.warn("[serviceExceptionHandler]\n\t{}", stackTrace[0]);
|
||||||
}
|
}
|
||||||
return CommonResult.error(ex.getCode(), ex.getMessage());
|
return CommonResult.error(ex.getCode(), ex.getMessage());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue