Created
August 5, 2019 10:34
-
-
Save pc-magas/580e023f2c0a5c4cd8c1e41706a4fb03 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
const mandrill = require('node-mandrill')('ThisIsMyDummyApiKey'); | |
const sendEmail = async () => { | |
return await mandrill('/messages/send', { | |
message: { | |
to: [{email: 'git@jimsc.com', name: 'Jim Rubenstein'}], | |
from_email: 'you@domain.com', | |
subject: "Hey, what's up?", | |
text: "Hello, I sent this message using mandrill." | |
} | |
}); | |
} | |
/** | |
* How I Need to refactor my method in order to handle errors with the following piece of code? | |
*/ | |
try{ | |
const response = await sendEmail() | |
console.log(response) | |
} catch(e) { | |
console.error(e); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment