Skip to content

Instantly share code, notes, and snippets.

@calvinmetcalf
Created August 21, 2013 10:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save calvinmetcalf/6292736 to your computer and use it in GitHub Desktop.
Save calvinmetcalf/6292736 to your computer and use it in GitHub Desktop.
function addPromise(a,b){
return resolve(a,b);
}
addPromise(2,3).then(function(data){
console.log(data);
},function(err){
console.log('oh noes!');
});
//the error could be called if say this other function returns a promise and errored
somethingelse().then(function(data){
return addPromise(data,2);
}).then(function(data){
console.log(data);
},function(err){
console.log('oh noes!');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment