Skip to content

Instantly share code, notes, and snippets.

@justengland
Created February 19, 2018 15:59
Show Gist options
  • Save justengland/73a40c8a70211e736c663564d28df5c3 to your computer and use it in GitHub Desktop.
Save justengland/73a40c8a70211e736c663564d28df5c3 to your computer and use it in GitHub Desktop.
promise error example
function simulateSubmit (errorMessage) {
return new Promise((resolve, reject) => {
setTimeout(() => {
if (errorMessage) reject(new Error(errorMessage))
else resolve()
}, 2000)
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment