mirror of
https://github.com/s-frick/effigenix.git
synced 2026-03-28 19:10:22 +01:00
feat: Sentry-kompatibles Error-Tracking (Bugsink) für Frontend und Backend
Frontend: @sentry/node mit instrument.ts, globale Error-Handler, 5xx-Interceptor. Backend: sentry-spring-boot-starter-jakarta, Sentry.captureException im GlobalExceptionHandler. Konfiguration über SENTRY_DSN Env-Variable, Bugsink via make bugsink startbar.
This commit is contained in:
parent
5fe0dfc139
commit
df1d1dfdd3
9 changed files with 818 additions and 6 deletions
|
|
@ -6,6 +6,13 @@
|
|||
import type { AxiosInstance, AxiosError } from 'axios';
|
||||
import { ApiError, AuthenticationError, NetworkError } from '../errors.js';
|
||||
|
||||
let captureException: ((err: unknown) => void) | undefined;
|
||||
try {
|
||||
const sentryModule = '@sentry/node';
|
||||
const Sentry: { captureException: (err: unknown) => void } = await import(sentryModule);
|
||||
captureException = Sentry.captureException;
|
||||
} catch { /* @sentry/node not available in this package */ }
|
||||
|
||||
interface BackendErrorResponse {
|
||||
message?: string;
|
||||
error?: string;
|
||||
|
|
@ -42,6 +49,10 @@ export function setupErrorInterceptor(client: AxiosInstance): void {
|
|||
return Promise.reject(new AuthenticationError(message, status));
|
||||
}
|
||||
|
||||
if (status >= 500 && captureException) {
|
||||
captureException(new ApiError(message, status, undefined, validationErrors));
|
||||
}
|
||||
|
||||
return Promise.reject(new ApiError(message, status, undefined, validationErrors));
|
||||
},
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue