Repository navigation
fix(core): Always return a string from _enhanceErrorWithSentryInfo - #26349
Merged
msonnb merged 2 commits intoNov 13, 2026
Merged
Conversation
An Error whose `message` is not a string (a number, an object, a function) used to end up as a non-string `exception.value`. Event processors that call string methods on it then threw, and the event was dropped, e.g. `DropReactControlFlowErrors` in @sentry/nextjs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
3 tasks done
Other objects go through stringifyValue, so an Error, Map or DOM Event
as the message no longer becomes '{}' or '{"isTrusted":true}'.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
msonnb
self-requested a review
November 13, 2026 10:01
msonnb
marked this pull request as ready for review
November 13, 2026 10:01
msonnb
added a commit
that referenced
this pull request
Nov 13, 2026
This PR adds the external contributor to the CHANGELOG.md file, so that they are credited for their contribution. See #26349 Co-authored-by: msonnb <26038247+msonnb@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why:
Error.messageis typed as a string, but code can assign anything to it. A number, object or function then ended up asexception.value, and an event processor that calls a string method on it (hereDropReactControlFlowErrorsin@sentry/nextjs) threw, so the event was dropped beforebeforeSend. As suggested in the issue, this makes_enhanceErrorWithSentryInfoalways return a string instead of guarding each processor.Primitives go through
String(), objects through the existingstringify(JSON), withstringifyValueas the fallback for functions and circular objects ([Function: name],[object Object]).null/undefinedbecome'', which keeps them falsy, so the browser'No error message'path is unchanged.How to review:
packages/core/src/utils/eventbuilder.ts, then the newexceptionFromErrorcases in the test file (all fail ondevelop).Unsure about: JSON for object messages.
{"code":42}reads better than[object Object], but tell me if you'd rather keep it shorter.Closes #26329