Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Promise.resolve(process.hrtime())
- .then(returnAPromise)
- .then(returnAValue)
- .then(returnAPromise)
- .then(throwAnException)
- .catch(handleExceptionAndReturnPromise)
- .then(returnAPromise)
- .then(throwAnException)
- .catch(handleFinalException)
- function returnAPromise(value) {
- console.log(value);
- return Promise.resolve(process.hrtime());
- }
- function returnAValue(value) {
- console.log(value);
- return process.hrtime();
- }
- function handleFinalException(error) {
- console.log("all done", error);
- }
- function throwAnException(value) {
- console.log(value, "about to throw!");
- throw "exception thrown!";
- }
- function handleExceptionAndReturnPromise(error) {
- console.log(error);
- return Promise.resolve(process.hrtime());
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement