Skip to content

fix(react): Don't crash ErrorBoundary when error.cause is not an Error - #25542

Merged
andreiborza merged 1 commit into
getsentry:developfrom
4ktLuffy:fix/react-error-boundary-primitive-cause
Oct 21, 2026
Merged

andreiborza merged 1 commit into
getsentry:developfrom
4ktLuffy:fix/react-error-boundary-primitive-cause

Conversation

@4ktLuffy

Copy link
Copy Markdown
Contributor

When the caught error has a cause that isn't an Error, e.g. new Error('x', { cause: 'timeout' }), setCause tried to set .cause on that value. For a string this throws, so the boundary never shows its fallback and the original error is never captured. It now stops at a non-Error cause, which LinkedErrors can't link anyway.

Follow-up to #6167, which covered thrown non-Error values but not non-Error causes.

@4ktLuffy
4ktLuffy requested a review from a team as a code owner October 19, 2026 19:18
@4ktLuffy
4ktLuffy requested review from chargome and s1gr1d and removed request for a team October 19, 2026 19:18
@github-actions github-actions Bot added the external PR from an external contributor label Oct 19, 2026
@andreiborza
andreiborza merged commit 6fb6b07 into getsentry:develop Oct 21, 2026
128 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

external PR from an external contributor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants