Last active
August 29, 2015 14:23
-
-
Save joepie91/e13f29d13f517c85d816 to your computer and use it in GitHub Desktop.
Revisions
-
joepie91 revised this gist
Aug 9, 2015 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -8,7 +8,7 @@ doAsyncThing.then(function(result){ /* This is where errors from *any* of the above promises end up. */ }); /* ... is functionally the same as ... */ Promise.try(function(){ return doAsyncThing(); -
joepie91 created this gist
Jun 29, 2015 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,23 @@ doAsyncThing.then(function(result){ return doAnotherAsyncThing().then(function(result){ return doYetAnotherAsyncThing().then(function(result){ console.log("Done!"); }); }); }).catch(function(err){ /* This is where errors from *any* of the above promises end up. */ }); /* ... is functionally equivalent to ... */ Promise.try(function(){ return doAsyncThing(); }).then(function(result){ return doAnotherAsyncThing(); }).then(function(result){ return doYetAnotherAsyncThing(); }).then(function(result){ console.log("Done!"); }).catch(function(err){ /* This is where errors from *any* of the above promises end up. */ });