Commit d2f2c2b49a98061bb462ec1b8aa9f23f42e8dee9
Merge branch 'master-jdk17' of https://gitee.com/zhijiantianya/ruoyi-vue-pro into master-jdk17
Showing
1 changed file
with
5 additions
and
0 deletions
yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/web/core/handler/GlobalExceptionHandler.java
| ... | ... | @@ -313,6 +313,11 @@ public class GlobalExceptionHandler { |
| 313 | 313 | // 忽略日志,避免影响主流程 |
| 314 | 314 | } |
| 315 | 315 | } |
| 316 | + // ServiceException 的错误码可能为成功码,直接调用 CommonResult.error 会抛出异常,此处统一按系统异常处理。 | |
| 317 | + // 详见 Issue #1196:https://github.com/YunaiV/ruoyi-vue-pro/issues/1196 | |
| 318 | + if (CommonResult.isSuccess(ex.getCode())) { | |
| 319 | + return CommonResult.error(INTERNAL_SERVER_ERROR.getCode(), INTERNAL_SERVER_ERROR.getMsg()); | |
| 320 | + } | |
| 316 | 321 | return CommonResult.error(ex.getCode(), ex.getMessage()); |
| 317 | 322 | } |
| 318 | 323 | ... | ... |