mirror of
https://github.com/compiler-explorer/compiler-explorer.git
synced 2025-12-27 07:04:04 -05:00
Add Sentry error reporting and user alert for history validation failures
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 <noreply@anthropic.com>
This commit is contained in:
@@ -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 ' +
|
||||
'<a href="https://github.com/compiler-explorer/compiler-explorer/issues">our github</a>.',
|
||||
{isError: true},
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user