GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(core): Always return a string from `_enhanceErrorWithSentryInfo` by bardrop · Pull Request #26349 · getsentry/sentry-javascript

Conversation

@bardrop

@bardrop bardrop commented Nov 13, 2026

Copy link
Copy Markdown
Contributor

Why: Error.message is typed as a string, but code can assign anything to it. A number, object or function then ended up as exception.value, and an event processor that calls a string method on it (here DropReactControlFlowErrors in @sentry/nextjs) threw, so the event was dropped before beforeSend. As suggested in the issue, this makes _enhanceErrorWithSentryInfo always return a string instead of guarding each processor.

Primitives go through String(), objects through the existing stringify (JSON), with stringifyValue as the fallback for functions and circular objects ([Function: name], [object Object]). null/undefined become '', which keeps them falsy, so the browser 'No error message' path is unchanged.

How to review: packages/core/src/utils/eventbuilder.ts, then the new exceptionFromError cases in the test file (all fail on develop).

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

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@bardrop @claude
fix(core): Always return a string from _enhanceErrorWithSentryInfo
34c50a3
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 <[email protected]>
@github-actions github-actions Bot added the external PR from an external contributor label Nov 13, 2026
@bardrop bardrop mentioned this pull request Nov 13, 2026
@sentry/nextjs: an Error whose message is not a string is dropped by DropReactControlFlowErrors ("includes is not a function") #26329
Closed
3 tasks done
@msonnb @claude
fix(core): Only JSON-stringify plain object and array error messages
2c489dc
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 <[email protected]>
@msonnb
msonnb self-requested a review November 13, 2026 10:01
@msonnb
msonnb marked this pull request as ready for review November 13, 2026 10:01
@msonnb
msonnb requested a review from a team November 13, 2026 10:01
@javascript-sdk-gitflow
javascript-sdk-gitflow Bot requested review from isaacs and logaretm November 13, 2026 10:02
msonnb
msonnb approved these changes Nov 13, 2026
View reviewed changes

@msonnb msonnb left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you!

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@msonnb
msonnb merged commit cb9e84c into getsentry:develop Nov 13, 2026
387 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@javascript-sdk-gitflow javascript-sdk-gitflow Bot mentioned this pull request Nov 13, 2026
chore: Add external contributor to CHANGELOG.md #26351
Merged
msonnb added a commit that referenced this pull request Nov 13, 2026
@javascript-sdk-gitflow @msonnb
chore: Add external contributor to CHANGELOG.md (#26351)
4ab39ab
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 <[email protected]>
@sentry-release-bot sentry-release-bot Bot mentioned this pull request Nov 16, 2026
publish: getsentry/[email protected] getsentry/publish#10451
Closed
51 tasks done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@msonnb msonnb msonnb approved these changes
@isaacs isaacs Awaiting requested review from isaacs
@logaretm logaretm Awaiting requested review from logaretm

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

external PR from an external contributor

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

@sentry/nextjs: an Error whose message is not a string is dropped by DropReactControlFlowErrors ("includes is not a function")

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@bardrop @msonnb
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.