var p1 = new Promise((resolve, reject) => {
// throw Error('Something went wrong in the promise')
resolve(42);
});
p1.then(
(value) => {
// throw Error('Something went wrong in the handler')
console.log(value)
},
(error) => {
// this would log if the Promise was rejected or
// an exception was thrown in the Promise
console.log(error);
}
).catch((error) => {
// this would log if an error occurred in the handler
console.log(error)
});
Last active
June 11, 2018 12:06
-
-
Save amysimmons/567e66c25840203b123c4af19e2ddd53 to your computer and use it in GitHub Desktop.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment