Use `reportError` to deal with unhandled errors
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 31.7k
- Forks
- 3k
- PR merge metrics
- No merged PRs in 30d
Description
I knew this API was coming, and we want to keep an eye on it.
What/Why
reportError is something we probably want to switch to. It reports the error synchronously to window.onerror. This is a minor advantage over the setTimeout trick we're currently doing, as it's more deterministic.
Current Issues
Currently, it's not going to work for us for a couple of reasons:
- It's not available in Safari or Node.
- We have some logic around
config.onUnhandledErrorthat we call in asetTimeoutif it exists. It currently doesn't check that it exists until the timeout fires, and changing that would be a breaking change. We'd need to check for the existence ofonUnhandledErrorsynchronously before we could attempt to usereportErrorif it existed. If it didn't exist, we'd need to use thesetTimeouttrick.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the current unhandled-error path that uses the setTimeout fallback and the config.onUnhandledError check. Compare its browser and Node behavior with reportError and window.onerror; done means using reportError where supported without breaking the existing callback timing or fallback behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, typescript
- Domain
- web-dev
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100