Created
April 16, 2017 16:35
-
-
Save jboxman/87953713660edf1f41114f7c38662661 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var rejectedPromise = Promise.reject(new Error('Whatever')); | |
const p = new Promise( | |
(fulfill, reject) => { | |
setTimeout(() => rejectedPromise.then(fulfill, reject), 1000); | |
} | |
); | |
p.then(value => console.log(value)).catch(console.log('rejected')); | |
/* | |
rejected | |
(node:5476) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: Whatever | |
(node:5476) DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will term | |
inate the Node.js process with a non-zero exit code. | |
(node:5476) PromiseRejectionHandledWarning: Promise rejection was handled asynchronously (rejection id: 1) | |
(node:5476) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 2): Error: Whatever | |
/* |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment