add Sentry
This commit is contained in:
parent
5332370c32
commit
f2783d14da
8
pom.xml
8
pom.xml
@ -73,6 +73,14 @@
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- Sentry -->
|
||||
<dependency>
|
||||
<groupId>io.sentry</groupId>
|
||||
<artifactId>sentry-spring-boot-starter-jakarta</artifactId>
|
||||
<version>7.8.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- Tests -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
|
@ -2,6 +2,7 @@ package cc.fascinated.backend.exception;
|
||||
|
||||
import cc.fascinated.backend.model.response.ErrorResponse;
|
||||
import io.micrometer.common.lang.NonNull;
|
||||
import io.sentry.Sentry;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.ControllerAdvice;
|
||||
@ -39,6 +40,7 @@ public final class ExceptionControllerAdvice {
|
||||
}
|
||||
if (status == null) { // Fallback to 500
|
||||
status = HttpStatus.INTERNAL_SERVER_ERROR;
|
||||
Sentry.captureException(ex); // Capture the exception
|
||||
}
|
||||
return new ResponseEntity<>(new ErrorResponse(status, message), status);
|
||||
}
|
||||
|
@ -19,6 +19,11 @@ spring:
|
||||
database: test
|
||||
port: 27017
|
||||
|
||||
# Sentry Configuration
|
||||
sentry:
|
||||
dsn: ""
|
||||
tracesSampleRate: 1.0
|
||||
|
||||
# Paste Configuration
|
||||
paste:
|
||||
# The length of the ID for the paste
|
||||
|
Reference in New Issue
Block a user