Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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