Skip to content

Instantly share code, notes, and snippets.

@desaijay315
Last active March 30, 2019 08:57
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 desaijay315/b4ded4815a1043b57a4b461bbbd91d69 to your computer and use it in GitHub Desktop.
Save desaijay315/b4ded4815a1043b57a4b461bbbd91d69 to your computer and use it in GitHub Desktop.
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