Last active
March 30, 2019 08:57
-
-
Save desaijay315/b4ded4815a1043b57a4b461bbbd91d69 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
async function email(address) { | |
try { | |
// Do something asynchronous that may throw... | |
await sendEmail({ to: address, from: 'noreply@domain.com', subject: 'Hello' }); | |
} catch(err) { | |
if (err instanceof SomeCustomError) { | |
elegantlyHandleError(err) | |
} else { | |
throw err | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment