web: send response info when response is thrown

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2021-04-20 17:32:38 +02:00
parent a8998a6356
commit 5955394c1d
1 changed files with 5 additions and 1 deletions

View File

@ -19,10 +19,14 @@ export function configureSentry(): Promise<Config> {
],
tracesSampleRate: 0.6,
environment: config.errorReportingEnvironment,
beforeSend(event: Sentry.Event, hint: Sentry.EventHint) {
beforeSend: async (event: Sentry.Event, hint: Sentry.EventHint): Promise<Sentry.Event | null> => {
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({