Skip to content

Normalise non-Error values before reporting to Sentry - #1323

Merged
microbit-matt-hillsdon merged 1 commit into
mainfrom
sentry-normalise-errors
Sep 10, 2026
Merged

Normalise non-Error values before reporting to Sentry#1323
microbit-matt-hillsdon merged 1 commit into
mainfrom
sentry-normalise-errors

Conversation

@microbit-matt-hillsdon

Copy link
Copy Markdown
Collaborator

The simulator's internal_error message carries Emscripten's ExitStatus, a plain constructor that does not extend Error. After structured cloning over postMessage it is a bare {name, message, status} object, which Sentry titles "Object captured as exception with keys: ..." and groups together regardless of cause.

reportError now converts any non-Error into an Error carrying the original name and message, with remaining fields merged into extra alongside any caller-supplied context. The synthesised stack is dropped because it would only show the logging call chain, identical for every caller, and Sentry would group unrelated errors together on it.

Fixes #1319

@github-actions

Copy link
Copy Markdown

@microbit-matt-hillsdon
microbit-matt-hillsdon added this pull request to stack #1324 September 10, 2026 12:37
Base automatically changed from codemirror-crash-logging to main September 10, 2026 13:17
The simulator's internal_error message carries Emscripten's ExitStatus,
a plain constructor that does not extend Error. After structured cloning
over postMessage it is a bare {name, message, status} object, which
Sentry titles "Object captured as exception with keys: ..." and groups
together regardless of cause.

reportError now converts any non-Error into an Error carrying the
original name and message, with remaining fields merged into extra
alongside any caller-supplied context. The synthesised stack is dropped
because it would only show the logging call chain, identical for every
caller, and Sentry would group unrelated errors together on it.

Fixes #1319
@microbit-matt-hillsdon

Copy link
Copy Markdown
Collaborator Author

It's questionable whether ExitStatus is intended to be reported by this channel. But it's super opaque in Sentry as-is. So let's start with this and confirm what we're actually seeing, then likely dive down a layer into the sim.

@microbit-matt-hillsdon
microbit-matt-hillsdon merged commit 11462f0 into main Sep 10, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Simulator internal errors reach Sentry as untyped objects

1 participant