Skip to content

Instantly share code, notes, and snippets.

@gisderdube
Created November 13, 2018 12:25
Show Gist options
  • Save gisderdube/fc78d0f9db8ad6fc73d08a33bac0ce0a to your computer and use it in GitHub Desktop.
Save gisderdube/fc78d0f9db8ad6fc73d08a33bac0ce0a to your computer and use it in GitHub Desktop.
Promise.resolve(1)
.then(res => {
console.log(res) // 1
throw new Error('something went wrong')
return Promise.resolve(2)
})
.then(res => {
console.log(res) // will not get executed
})
.catch(err => {
console.error(err) // we will see what to do with it later
return Promise.resolve(3)
})
.then(res => {
console.log(res) // 3
})
.catch(err => {
// in case in the previous block occurs another error
console.error(err)
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment