Advertisement
Guest User

Untitled

a guest
Sep 30th, 2014
171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var Promise = require('bluebird');
  2.  
  3. function doSomething() {
  4.     // return Promise.resolve();
  5.     // return Promise.reject(new Error("Error doSomething"));
  6.     return new Promise(function (f, r) {
  7.         f();
  8.     });
  9. }
  10.  
  11. function doAnother() {
  12.     // return Promise.reject(new Error("Error doAnother"));
  13.     return new Promise(function (f, r) {
  14.         r(new Error("Error doAnother"));
  15.     });
  16. }
  17.  
  18. doSomething().then(doAnother).then(function() {
  19.     console.log("fullifillidHandler");
  20. }, function(err) {
  21.     console.log("rejectHandler", err.message);
  22. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement