From e4fe69941b2dd4582ec0bd82c32b8dfbc30d85b5 Mon Sep 17 00:00:00 2001
From: 廖井涛 <2265517004@qq.com>
Date: 星期四, 22 二月 2024 08:06:43 +0800
Subject: [PATCH] Merge branch 'master' of http://10.153.19.25:10101/r/ERP_override
---
north-glass-erp/src/main/java/com/example/erp/exception/GlobalExceptionHandle.java | 18 ++++++++++++++++++
1 files changed, 18 insertions(+), 0 deletions(-)
diff --git a/north-glass-erp/src/main/java/com/example/erp/exception/GlobalExceptionHandle.java b/north-glass-erp/src/main/java/com/example/erp/exception/GlobalExceptionHandle.java
new file mode 100644
index 0000000..e353e73
--- /dev/null
+++ b/north-glass-erp/src/main/java/com/example/erp/exception/GlobalExceptionHandle.java
@@ -0,0 +1,18 @@
+package com.example.erp.exception;
+
+import com.example.erp.common.Result;
+import org.springframework.web.bind.annotation.ControllerAdvice;
+import org.springframework.web.bind.annotation.ExceptionHandler;
+import org.springframework.web.bind.annotation.ResponseBody;
+
+@ControllerAdvice
+public class GlobalExceptionHandle {
+ /**
+ * 濡傛灉鏄痵erviceExcaption锛屽垯璋冪敤璇ユ柟娉�
+ */
+ @ExceptionHandler(ServiceException.class)
+ @ResponseBody
+ public Result handle(ServiceException se){
+ return Result.error(se.getCode(),se.getMessage());
+ }
+}
--
Gitblit v1.8.0