Skip to content

Instantly share code, notes, and snippets.

@jayphelps
Created October 17, 2017 07:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jayphelps/72dc650d56bb7714cc08b402b4b8a28f to your computer and use it in GitHub Desktop.
Save jayphelps/72dc650d56bb7714cc08b402b4b8a28f to your computer and use it in GitHub Desktop.
in situations like tc39 Observable when it should "swallow" errors, but we still want to report them to window.onerror (HostReportErrors) and in the console
function dispatchSwallowedError(e) {
window.dispatchEvent(new ErrorEvent('error', {
error: e,
message: e.message
}));
console.error(e);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment