Skip to content

Instantly share code, notes, and snippets.

@colwem
Created March 30, 2016 04:08
Show Gist options
  • Save colwem/ce9dfdb3b32c7daa0a580bf40ffc46fe to your computer and use it in GitHub Desktop.
Save colwem/ce9dfdb3b32c7daa0a580bf40ffc46fe to your computer and use it in GitHub Desktop.
'use strict';
var Promise = require('bluebird');
var foo = function() {
return new Promise(function(resolve, reject) {
setTimeout(function() {
reject();
}, 1000);
});
};
var i = setInterval(function() {
console.log("yes!");
}, 300);
foo().catch(function(e) {
console.log("no...");
throw new Error('hhoooo boy...');
});
yes!
yes!
yes!
no...
Unhandled rejection Error: hhoooo boy...
at /Users/colwem/workshop/RxJSKoans/testother.js:18:9
at tryCatcher (/Users/colwem/workshop/RxJSKoans/node_modules/bluebird/js/release/util.js:16:23)
at Promise._settlePromiseFromHandler (/Users/colwem/workshop/RxJSKoans/node_modules/bluebird/js/release/promise.js:503:31)
at Promise._settlePromise (/Users/colwem/workshop/RxJSKoans/node_modules/bluebird/js/release/promise.js:560:18)
at Promise._settlePromise0 (/Users/colwem/workshop/RxJSKoans/node_modules/bluebird/js/release/promise.js:605:10)
at Promise._settlePromises (/Users/colwem/workshop/RxJSKoans/node_modules/bluebird/js/release/promise.js:680:18)
at Async._drainQueue (/Users/colwem/workshop/RxJSKoans/node_modules/bluebird/js/release/async.js:126:16)
at Async._drainQueues (/Users/colwem/workshop/RxJSKoans/node_modules/bluebird/js/release/async.js:136:10)
at Immediate.Async.drainQueues [as _onImmediate] (/Users/colwem/workshop/RxJSKoans/node_modules/bluebird/js/release/async.js:16:14)
at processImmediate [as _immediateCallback] (timers.js:516:17)
yes!
yes!
yes!
yes!
yes!
yes!
yes!
yes!
yes!
yes!
yes!
yes!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment