Skip to content
This repository was archived by the owner on Feb 26, 2024. It is now read-only.

feat(promise), fix #621, add unhandledRejection handler and ignore consoleError#627

Merged
mhevery merged 1 commit intoangular:masterfrom
JiaLiPassion:unhandle
Feb 8, 2017
Merged

feat(promise), fix #621, add unhandledRejection handler and ignore consoleError#627
mhevery merged 1 commit intoangular:masterfrom
JiaLiPassion:unhandle

Conversation

@JiaLiPassion
Copy link
Copy Markdown
Collaborator

@JiaLiPassion JiaLiPassion commented Feb 4, 2017

  1. add a flag to ignore consleError when uncaught promise error occurs, just like ignore consoleError when run promise a+ test to avoid annoying error … #614.
  2. trigger unhandledrejection and rejectionhandled event handler in browser and nodejs env.
    fix unhandledrejection even is not fired #621.

the spec can be found here.

 window.addEventListener("unhandledrejection", function (event) {
  console.warn("WARNING: Unhandled promise rejection. Shame on you! Reason: "
               + event.reason);
});

window.addEventListener("rejectionhandled", function (event) {
  console.log("Promise rejected! Reason: " + reason);
});
process.on('unhandledRejection', (reason, p) => {
  console.log('Unhandled Rejection at: Promise', p, 'reason:', reason);
  // application specific logging, throwing an error, or other logic here
});

process.on('rejectionHandled', (p) => {
});

@JiaLiPassion JiaLiPassion changed the title feat(promise), add unhandledRejection handler and ignore consoleError feat(promise), fix #621, add unhandledRejection handler and ignore consoleError Feb 4, 2017
@mhevery
Copy link
Copy Markdown
Contributor

mhevery commented Feb 7, 2017

Sorry this no longer applies cleanly. Could you rebase?

@JiaLiPassion
Copy link
Copy Markdown
Collaborator Author

Sure,will do

@JiaLiPassion
Copy link
Copy Markdown
Collaborator Author

@mhevery , I have rebased the PR, please review.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

unhandledrejection even is not fired

3 participants