Created
September 5, 2022 15:47
-
-
Save n370/a88aa1120800a447462407671ae77863 to your computer and use it in GitHub Desktop.
This file contains 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
// @err {string} - Optional error message. | |
function fake(err) { | |
return new Promise((resolve, reject) => { | |
const msg = prompt('Cancel to simulate an API failure or add a message and Confirm to simulate a successful call') | |
if (!msg) { | |
return reject(err) | |
} | |
resolve(msg) | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment