From b8d0d48190c29b7bf97ffa0a940f28739b9eef62 Mon Sep 17 00:00:00 2001 From: Matt Godbolt Date: Sat, 21 Jun 2025 21:24:08 -0500 Subject: [PATCH] Add Sentry error reporting and user alert for history validation failures MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Addresses PR feedback to match the error handling pattern used for URL deserialization failures. Now logs errors to Sentry with context and shows an alert dialog to inform users when history configurations fail validation. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- static/main.ts | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/static/main.ts b/static/main.ts index 459dbc231..135468264 100644 --- a/static/main.ts +++ b/static/main.ts @@ -228,8 +228,20 @@ function setupButtons(options: CompilerExplorerOptions, hub: Hub) { window.history.replaceState(null, '', window.httpRoot); window.location.reload(); } catch (e) { - console.error('Invalid configuration from history:', e); - // Could show user error or fall back to default + // Log history configuration corruption to Sentry for monitoring + SentryCapture( + e, + `History configuration validation failure: config=${JSON.stringify(data.config).substring(0, 200)}`, + ); + // Alert the user that the history configuration is invalid + const alertSystem = new Alert(); + alertSystem.alert( + 'History Error', + 'An error was encountered while loading the history configuration. ' + + 'Please try selecting a different history entry or contact us on ' + + 'our github.', + {isError: true}, + ); } });