From 829f629756e5402bcd3e9f6ef1f9c6dbffbabb11 Mon Sep 17 00:00:00 2001
From: KKSU <15274802129@163.com>
Date: Wed, 17 Apr 2024 14:46:29 +0800
Subject: [PATCH] 55测试环境
---
src/main/java/com/xcong/excoin/common/aop/ExceptionCatchAspect.java | 12 ++++++++++--
1 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/src/main/java/com/xcong/excoin/common/aop/ExceptionCatchAspect.java b/src/main/java/com/xcong/excoin/common/aop/ExceptionCatchAspect.java
index 2a39a9f..79f4c13 100644
--- a/src/main/java/com/xcong/excoin/common/aop/ExceptionCatchAspect.java
+++ b/src/main/java/com/xcong/excoin/common/aop/ExceptionCatchAspect.java
@@ -17,6 +17,7 @@
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.MethodArgumentNotValidException;
+import org.springframework.web.client.ResourceAccessException;
import javax.net.ssl.SSLException;
import javax.validation.ValidationException;
@@ -45,17 +46,24 @@
@Value("${spring.profiles.active}")
private String profiles;
+ @Value("${app.project}")
+ private String projectName;
+
@Pointcut("execution(* com.xcong.excoin..*.*(..))")
public void exceptionCatch() {
}
@AfterThrowing(pointcut = "exceptionCatch()", throwing = "ex")
public void afterThrows(JoinPoint jp, Exception ex) throws Exception {
- if (ex instanceof GlobalException || ex instanceof MethodArgumentNotValidException || ex instanceof ValidationException || ex instanceof DuplicateKeyException || ex instanceof BadCredentialsException || ex instanceof UsernameNotFoundException || ex instanceof SSLException) {
+ if (ex instanceof ResourceAccessException || ex instanceof GlobalException || ex instanceof MethodArgumentNotValidException || ex instanceof ValidationException || ex instanceof DuplicateKeyException || ex instanceof BadCredentialsException || ex instanceof UsernameNotFoundException || ex instanceof SSLException) {
throw ex;
}
if (EXCLUDE_EXCEPTION.contains(ex.getMessage())) {
+ throw ex;
+ }
+
+ if ("dev".equals(profiles) || "test".equals(profiles)) {
throw ex;
}
@@ -67,7 +75,7 @@
try {
log.info("插入");
exceptionData.setCreateTime(new Date());
- exceptionData.setMachine(InetAddress.getLocalHost().getHostName() + "-" + profiles);
+ exceptionData.setMachine(projectName + "-" +InetAddress.getLocalHost().getHostName() + "-" + profiles);
exceptionData.setAddress(InetAddress.getLocalHost().getHostAddress());
exceptionData.setExceptionMsg(exStr);
exceptionData.setSimpleMsg(ex.getMessage());
--
Gitblit v1.9.1