From 526d68763ffc0c0b8c08caff5f58424a044831eb Mon Sep 17 00:00:00 2001 From: Rainnny7 Date: Sat, 27 Apr 2024 03:19:43 -0400 Subject: [PATCH] API: Capture unhandled exceptions with Sentry --- .../cc/restfulmc/api/exception/ExceptionControllerAdvice.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/API/src/main/java/cc/restfulmc/api/exception/ExceptionControllerAdvice.java b/API/src/main/java/cc/restfulmc/api/exception/ExceptionControllerAdvice.java index 85e47d4..8aeb0f1 100644 --- a/API/src/main/java/cc/restfulmc/api/exception/ExceptionControllerAdvice.java +++ b/API/src/main/java/cc/restfulmc/api/exception/ExceptionControllerAdvice.java @@ -24,6 +24,7 @@ package cc.restfulmc.api.exception; import cc.restfulmc.api.model.response.ErrorResponse; +import io.sentry.Sentry; import lombok.NonNull; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; @@ -66,6 +67,7 @@ public final class ExceptionControllerAdvice { } if (status == null) { // Fallback to 500 status = HttpStatus.INTERNAL_SERVER_ERROR; + Sentry.captureException(ex); // Capture with Sentry } return new ResponseEntity<>(new ErrorResponse(status, message), status); }