Replies: 2 comments 1 reply
|
@bedaka if I understand your problem right, you can create a custom trait, where you need to manually build a Sentry event and pass there any information you need about the error itself, plus what comes from the For example: @ControllerAdvice
class SentryAdviceTrait implements ProblemHandling {
private final IHub hub;
SentryAdviceTrait(IHub hub) {
this.hub = hub;
}
@Override
public ResponseEntity<Problem> create(Throwable throwable, NativeWebRequest request) {
ResponseEntity<Problem> result = ProblemHandling.super.create(throwable, request);
SentryEvent event = new SentryEvent();
event.setExtra("response_status", result.getStatusCodeValue());
event.setThrowable(throwable);
hub.captureEvent(event);
return result;
}
}Note that details about the HTTP request are added there automatically. Look at https://github.com/getsentry/sentry-java/blob/main/sentry-spring/src/main/java/io/sentry/spring/SentryExceptionResolver.java#L45 as a reference. Does it solve your issue? |
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Hello everyone,
I'm trying to integrate sentry in our java spring-boot-starter service. Since we're also using the zalando problem-spring-web library for exception handling, I wonder if anyone has some experience in how to make this setup work together.
exception-resolver-order: -2147483647as suggested in the Sentry documentation errors do appear in Sentry, but they're "unhanded" and error codes are missing.I wonder if I have to modify the Advice Traits or if there is another way that I'm currently not seeing.
Thanks in advance
All reactions