Created
August 25, 2018 00:40
-
-
Save davalapar/298949e905f3a39b8405ec00a3d43be4 to your computer and use it in GitHub Desktop.
failure-first-approach.js
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
// do we have errors? | |
if (condition === false) { | |
return new Error('reason goes here') || Promise.reject(new Error('reason goes here')); // either | |
} | |
// are tasks needed? | |
if (condition === false) { | |
return tasks(); | |
} | |
return Promise.resolve(); |
Author
davalapar
commented
Sep 13, 2018
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment