Last active
December 7, 2016 10:55
-
-
Save aherve/013a495705b89f192a81741f4aa71ca9 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
| function demoPromise (userId) { | |
| User | |
| .findById(userId) | |
| .then(doSomethingAsync) // doSomething will receive `user` as argument if everything goes smoothly | |
| .catch(dealWithIt) // here we catch both the `findById` and `doSomethingAsync` errors at once | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment