Created
March 7, 2018 16:20
-
-
Save dkstevekwak/0c3a25c8091e736dee0b71f604a85c5d to your computer and use it in GitHub Desktop.
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 characters
| /* Catching errors in promisified functions */ | |
| runEvalScript('firstFunction()') | |
| .then(function(firstResult){ | |
| return runEvalScript(`secondFunction(${firstResult})`) | |
| }) | |
| .catch(function(error) { | |
| //handle any error that may occur in firstFunction() | |
| } | |
| .then(function(secondResult){ | |
| return runEvalScript(`thirdFunction(${secondResult})`) | |
| }) | |
| .then(function(thirdResult){ | |
| // more promises..! | |
| }) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment