rxjs
rxjs copied to clipboard
Use `reportError` to deal with unhandled errors
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.
Core Team: Waiting on Node to stabilize their decision on this. (cc @benjamingr, who I think is working on getting this in Node)
@benjamingr Has there been any movement here?