From d8d82ceda75fa17972d6996f83078367a19c1730 Mon Sep 17 00:00:00 2001
From: Junjie <fallin.jie@qq.com>
Date: 星期四, 12 三月 2026 15:38:32 +0800
Subject: [PATCH] #
---
src/main/java/com/zy/common/config/CoolExceptionHandler.java | 12 ++++++++----
1 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/src/main/java/com/zy/common/config/CoolExceptionHandler.java b/src/main/java/com/zy/common/config/CoolExceptionHandler.java
index aacc45a..c33ca24 100644
--- a/src/main/java/com/zy/common/config/CoolExceptionHandler.java
+++ b/src/main/java/com/zy/common/config/CoolExceptionHandler.java
@@ -2,10 +2,11 @@
import com.core.common.R;
import com.core.exception.CoolException;
+import com.zy.common.i18n.I18nMessageService;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.HttpRequestMethodNotSupportedException;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;
-import org.springframework.web.method.HandlerMethod;
/**
* Created by vincent on 2019-06-09
@@ -13,15 +14,18 @@
@RestControllerAdvice
public class CoolExceptionHandler {
+ @Autowired
+ private I18nMessageService i18nMessageService;
+
@ExceptionHandler(Exception.class)
- public R handlerException(HandlerMethod handler, Exception e) {
+ public R handlerException(Exception e) {
e.printStackTrace();
- return R.error();
+ return R.error(i18nMessageService.getMessage("response.common.systemError"));
}
@ExceptionHandler(HttpRequestMethodNotSupportedException.class)
public R handleHttpRequestMethodNotSupportedException(HttpRequestMethodNotSupportedException e) {
- return R.error();
+ return R.error(i18nMessageService.getMessage("response.common.methodNotAllowed"));
}
@ExceptionHandler(CoolException.class)
--
Gitblit v1.9.1