Skip to content

Instantly share code, notes, and snippets.

@n370
Created September 5, 2022 15:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save n370/a88aa1120800a447462407671ae77863 to your computer and use it in GitHub Desktop.
Save n370/a88aa1120800a447462407671ae77863 to your computer and use it in GitHub Desktop.
// @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