Closed RhodesPeter closed 7 years ago
:exclamation: No coverage uploaded for pull request base (
master@13f4490
). Click here to learn what that means. The diff coverage is63.63%
.
@@ Coverage Diff @@
## master #111 +/- ##
=========================================
Coverage ? 91.11%
=========================================
Files ? 3
Lines ? 45
Branches ? 4
=========================================
Hits ? 41
Misses ? 4
Partials ? 0
Impacted Files | Coverage Δ | |
---|---|---|
src/routes.js | 100% <100%> (ø) |
|
src/server.js | 100% <100%> (ø) |
|
src/send-email.js | 50% <50%> (ø) |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact)
,ø = not affected
,? = missing data
Powered by Codecov. Last update 13f4490...146a543. Read the comment docs.
Hey @des-des, we have made most of the changes you suggested (I've pushed it up). Would it be possible to point us in the right direction in regards to making the sendMain function handle the errors correctly?
@RhodesPeter Send mail is an asynchronous function. It must either take a callback or return a promise. In the first case it will call the callback passing an error as the first argument. In the second case it will return a promise.reject object.
This means that sendmail
will return control to the caller when the asynchronous action has resolved. With a hapi server, I try too keep as much business logic in the handler functions as possible (think of the handlers as the controllers if that helps). The handler will decide what to do in the case where sendmail fails.
For MVP, I would not worry too much about exactly what the handler / client would do in the error case, you can just throw back a 500 and log the error.
Ok @des-des - I have added a callback to the sendMail function. Is this what you had in mind?
@RhodesPeter yup perfect
Related #70 & #74