From db966eeb9dec540a0e176da73479d6d413d339f1 Mon Sep 17 00:00:00 2001 From: Sebastian Serth Date: Thu, 30 May 2024 22:14:30 +0200 Subject: [PATCH] Capture non-JSON error in newSentryTransaction Using the JSON representation of the error only works for some errors, whereas others are simply marked with a {}. Still, we attach the JSON representation to the Sentry event captured. --- app/assets/javascripts/editor/editor.js.erb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/assets/javascripts/editor/editor.js.erb b/app/assets/javascripts/editor/editor.js.erb index cc91fa96..09a828dc 100644 --- a/app/assets/javascripts/editor/editor.js.erb +++ b/app/assets/javascripts/editor/editor.js.erb @@ -215,8 +215,8 @@ var CodeOceanEditor = { // WebSocket errors are handled in `showWebsocketError` already. if (error.target instanceof WebSocket) return; - console.error(JSON.stringify(error)); - Sentry.captureException(JSON.stringify(error), {mechanism: {handled: false}}); + console.error(error); + Sentry.captureException(error, {mechanism: {handled: false, data: {error_json: JSON.stringify(error)}}}); } }); });