API: Capture unhandled exceptions with Sentry
This commit is contained in:
parent
855b040e8f
commit
526d68763f
@ -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);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user