Skip to content

Instantly share code, notes, and snippets.

@Noitidart
Created September 27, 2016 18:04
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 Noitidart/768b78c07a9af333a42ff1bc774ba72a to your computer and use it in GitHub Desktop.
Save Noitidart/768b78c07a9af333a42ff1bc774ba72a to your computer and use it in GitHub Desktop.
function sayHello() {
return new Promise( (resolve,reject) => {
reject('rawr')
});
}
new Promise((resolve, reject) => sayHello()).then(ok => console.log('ok:', ok)).catch( err => console.error('err:', err) );
@marudhupandiyang
Copy link

You have rejected only the Promise returned in sayHello function. You have not either resolved nor rejected the outer promise on line 6. Hence your then or catch block won't execute.

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