suspensive
suspensive copied to clipboard
feat(react): Convert non-Error objects to Error instances in ErrorBoundary
- [x] Explore repository structure and understand ErrorBoundary implementation
- [x] Verify current behavior: non-Error objects (null, string, number, object) are NOT converted to Error instances
- [x] Update
getDerivedStateFromErrorto convert non-Error objects to Error instances - [x] Update
componentDidCatchto convert non-Error objects for onError callback - [x] Create
convertToErrorhelper function for consistent conversion logic - [x] Add comprehensive tests to verify non-Error objects are properly converted in fallback props
- [x] Add tests to verify onError callback receives Error instances
- [x] Update type signatures to accept
anytype for error parameters (following Sentry's approach) - [x] Add explanatory comments referencing Sentry's implementation
- [x] Run all tests to ensure no regressions (186 tests passed)
- [x] Run linter and type checker (no new errors)
Original prompt
This section details on the original issue you should resolve
<issue_title>[Feature]: If non error object thrown from children, ErrorBoundary should assert it as Error object in runtime</issue_title> <issue_description>### Package Scope
@suspensive/react
Description
If non error object thrown from children, ErrorBoundary should assert it as Error object in runtime
Possible Solution
No response
etc.
No response</issue_description>
Comments on the Issue (you are @copilot in this section)
Fixes toss/suspensive#1785
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.
The latest updates on your projects. Learn more about Vercel for GitHub.
| Project | Deployment | Preview | Comments | Updated (UTC) |
|---|---|---|---|---|
| v2.suspensive.org | Preview | Comment | Oct 15, 2025 9:28am | |
| v3.suspensive.org | Preview | Comment | Oct 15, 2025 9:28am | |
| visualization.suspensive.org | Preview | Comment | Oct 15, 2025 9:28am |
⚠️ No Changeset found
Latest commit: 109a5c0607127bb3bcfb9929668f2e1836e59f38
Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.
This PR includes no changesets
When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types
Click here to learn what changesets are, and how to add one.
Click here if you're a maintainer who wants to add a changeset to this PR
@copilot ref: https://github.com/getsentry/sentry-javascript/blob/develop/packages/react/src/error.ts#L55-L71
People can be co-author:
| Candidate | Reasons | Count | Add this as commit message |
|---|---|---|---|
| @Copilot | https://github.com/toss/suspensive/pull/1786 | 1 | Co-authored-by: Copilot <[email protected]> |
| @manudeli | https://github.com/toss/suspensive/pull/1786#issuecomment-3405291092 | 1 | Co-authored-by: manudeli <[email protected]> |
@copilot ref: https://github.com/getsentry/sentry-javascript/blob/develop/packages/react/src/error.ts#L55-L71
Updated the implementation to follow Sentry's approach. Changed type signatures for getDerivedStateFromError and componentDidCatch to accept any type instead of Error, acknowledging that these methods can be invoked with non-error objects. Added comments referencing the Sentry implementation and GitHub issue #6167. (commit: short hash will be in next message)
@copilot ref: https://github.com/getsentry/sentry-javascript/blob/develop/packages/react/src/error.ts#L55-L71
Updated the implementation to follow Sentry's approach. Changed type signatures for getDerivedStateFromError and componentDidCatch to accept any type instead of Error, acknowledging that these methods can be invoked with non-error objects. Added comments referencing the Sentry implementation and GitHub issue #6167. (109a5c0)
[!WARNING]
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
dummyjson.com
- Triggering command:
/usr/local/bin/node /home/REDACTED/work/suspensive/suspensive/node_modules/.pnpm/[email protected]_@babel+[email protected][email protected][email protected][email protected]/node_modules/next/dist/compiled/jest-worker/processChild.js(dns block)If you need me to access, download, or install something from one of these locations, you can either:
- Configure Actions setup steps to set up my environment, which run before the firewall is enabled
- Add the appropriate URLs or hosts to the custom allowlist in this repository's Copilot coding agent settings (admins only)