|
|
@@ -1,4 +1,4 @@ |
|
|
|
package work.xuye.common.alert; |
|
|
|
package tech.deepq.common.alert; |
|
|
|
|
|
|
|
import io.sentry.Sentry; |
|
|
|
import lombok.RequiredArgsConstructor; |
|
|
@@ -6,8 +6,8 @@ import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.aspectj.lang.annotation.AfterThrowing; |
|
|
|
import org.aspectj.lang.annotation.Aspect; |
|
|
|
import org.springframework.stereotype.Component; |
|
|
|
import work.xuye.common.enums.MessageType; |
|
|
|
import work.xuye.common.service.MessageService; |
|
|
|
import tech.deepq.common.enums.MessageType; |
|
|
|
import tech.deepq.common.service.MessageService; |
|
|
|
|
|
|
|
import java.util.List; |
|
|
|
|
|
|
@@ -23,13 +23,12 @@ public class ExceptionAspect { |
|
|
|
|
|
|
|
private final MessageService messageService; |
|
|
|
|
|
|
|
@AfterThrowing(pointcut = "execution(* work.xuye..*(..))&& !execution(* work.xuye.common.service.MessageService.*(..))", throwing = "ex") |
|
|
|
@AfterThrowing(pointcut = "execution(* tech.deepq..*(..))&& !execution(* tech.deepq.common.service.MessageService.*(..))", throwing = "ex") |
|
|
|
public void handleGlobalException(Exception ex) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<StackTraceElement> stackTraceElements = new java.util.ArrayList<>(List.of(ex.getStackTrace())); |
|
|
|
stackTraceElements.removeIf(stackTraceElement -> !stackTraceElement.getClassName().contains("work.xuye")); |
|
|
|
stackTraceElements.removeIf(stackTraceElement -> !stackTraceElement.getClassName().contains("tech.deepq")); |
|
|
|
StringBuilder traceString = new StringBuilder(); |
|
|
|
stackTraceElements.stream() |
|
|
|
.filter(stackTraceElement -> stackTraceElement.getLineNumber() > 0) |
|
|
@@ -40,7 +39,7 @@ public class ExceptionAspect { |
|
|
|
.append(stackTraceElement.getLineNumber()).append(")\n")); |
|
|
|
String traceStringString = traceString.toString(); |
|
|
|
|
|
|
|
if (traceStringString.contains("work.xuye.common.service.MessageService")){ |
|
|
|
if (traceStringString.contains("tech.deepq.common.service.MessageService")) { |
|
|
|
return; |
|
|
|
} |
|
|
|
|