From 5955394c1d33d2687cc264a4d58f427e4a3fc8c0 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Tue, 20 Apr 2021 17:32:38 +0200 Subject: [PATCH] web: send response info when response is thrown Signed-off-by: Jens Langhammer --- web/src/api/Sentry.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/web/src/api/Sentry.ts b/web/src/api/Sentry.ts index 8b3f304d1..ed772a2c6 100644 --- a/web/src/api/Sentry.ts +++ b/web/src/api/Sentry.ts @@ -19,10 +19,14 @@ export function configureSentry(): Promise { ], tracesSampleRate: 0.6, environment: config.errorReportingEnvironment, - beforeSend(event: Sentry.Event, hint: Sentry.EventHint) { + beforeSend: async (event: Sentry.Event, hint: Sentry.EventHint): Promise => { if (hint.originalException instanceof SentryIgnoredError) { return null; } + if (hint.originalException instanceof Response) { + const body = await hint.originalException.json(); + event.message = `${hint.originalException.status} ${hint.originalException.url}: ${JSON.stringify(body)}` + } if (event.exception) { me().then(user => { Sentry.showReportDialog({