Skip to content

Instantly share code, notes, and snippets.

@nodew
Created August 22, 2017 13:33
Show Gist options
  • Save nodew/ed21d29ed29e297f79cea380856cedeb to your computer and use it in GitHub Desktop.
Save nodew/ed21d29ed29e297f79cea380856cedeb to your computer and use it in GitHub Desktop.
promise.catch is sugar of `then` to handle error
new Promise((resolve, reject) => {
reject(false);
}).then(() => {}, (error) => {
console.log('error handle')
}).catch(error => {
console.log('catch')
})
// => error handle
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment