ReactiveX / ReactiveX/rxjs

Use `reportError` to deal with unhandled errors

Open
#6,795 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

8.x
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:

  1. It's not available in Safari or Node.
  2. We have some logic around config.onUnhandledError that we call in a setTimeout if 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 of onUnhandledError synchronously before we could attempt to use reportError if it existed. If it didn't exist, we'd need to use the setTimeout trick.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.