Advertisement
Guest User

Bluebird async rejection

a guest
Jan 30th, 2015
196
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var Promise = require('bluebird');
  2.  
  3. var rejection = Promise.reject('boo');
  4.  
  5. asyncStuff().then(function() {
  6.   rejection.catch(function(err) {
  7.     console.log('meh');
  8.   });
  9. });
  10.  
  11. function asyncStuff() {
  12.   return new Promise(function(resolve, reject) {
  13.     setTimeout(resolve);
  14.   });
  15. }
  16.  
  17. // Possibly unhandled Error: boo
  18. //    at Function.Promise.reject.Promise.rejected (./node_modules/bluebird/js/main/promise.js:274:21)
  19. //    at Object.<anonymous> (./argh.js:3:25)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement