Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
X
xyqb-user2
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
head_group
xyqb-user2
Commits
58f99877
Commit
58f99877
authored
Feb 13, 2023
by
王亮
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
config trace id for sentry.
parent
d3efdb32
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
1 deletion
+9
-1
CustomSentryExceptionResolver.java
...oup/xyqb/config/sentry/CustomSentryExceptionResolver.java
+9
-1
No files found.
src/main/java/cn/quantgroup/xyqb/config/sentry/CustomSentryExceptionResolver.java
View file @
58f99877
...
@@ -7,8 +7,11 @@ import cn.quantgroup.xyqb.exception.PasswordErrorLimitException;
...
@@ -7,8 +7,11 @@ import cn.quantgroup.xyqb.exception.PasswordErrorLimitException;
import
cn.quantgroup.xyqb.exception.UserRegisterLoginException
;
import
cn.quantgroup.xyqb.exception.UserRegisterLoginException
;
import
cn.quantgroup.xyqb.exception.VerificationCodeErrorException
;
import
cn.quantgroup.xyqb.exception.VerificationCodeErrorException
;
import
io.sentry.Sentry
;
import
io.sentry.Sentry
;
import
io.sentry.event.EventBuilder
;
import
io.sentry.event.interfaces.ExceptionInterface
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
javax.servlet.http.HttpServletResponse
;
import
org.slf4j.MDC
;
import
org.springframework.core.Ordered
;
import
org.springframework.core.Ordered
;
import
org.springframework.security.authentication.BadCredentialsException
;
import
org.springframework.security.authentication.BadCredentialsException
;
import
org.springframework.web.servlet.HandlerExceptionResolver
;
import
org.springframework.web.servlet.HandlerExceptionResolver
;
...
@@ -33,7 +36,12 @@ public class CustomSentryExceptionResolver implements HandlerExceptionResolver,
...
@@ -33,7 +36,12 @@ public class CustomSentryExceptionResolver implements HandlerExceptionResolver,
return
null
;
return
null
;
}
}
Sentry
.
capture
(
ex
);
EventBuilder
eventBuilder
=
new
EventBuilder
()
.
withSentryInterface
(
new
ExceptionInterface
(
ex
))
.
withMessage
(
ex
.
getMessage
())
.
withTag
(
"trace-id"
,
MDC
.
get
(
"X-B3-TraceId"
))
.
withTag
(
"span-id"
,
MDC
.
get
(
"X-B3-SpanId"
));
Sentry
.
capture
(
eventBuilder
.
build
());
// null = run other HandlerExceptionResolvers to actually handle the exception
// null = run other HandlerExceptionResolvers to actually handle the exception
return
null
;
return
null
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment