-
Notifications
You must be signed in to change notification settings - Fork 780
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update documentation to reflect use of promises. #870
Comments
Great idea @Berkmann18! Thanks for taking the time to make this suggestion. I have labeled it appropriately to get this change integrated into our docs. |
@sendgrid/mail
handling
@thinkingserious You're welcome. |
I included the missing bits to handle the asynchronous `send()` call including both ES6 and ES8 approaches which closes sendgrid#870.
) I included the missing bits to handle the asynchronous `send()` call including both ES6 and ES8 approaches which closes #870.
Thanks man this really helped me to fix an issue with my code. Thanks a lot. |
@Sammy-White No problem, I'm glad I helped. |
So I was digging around to see if this was promise-able or chainable. Nothing says it is, or even hints to it . . . and then I tripped across this issue. It's quite a missed boat. @Berkmann18 your doc suggestion is great. Thought about making a PR? |
It's not an issue per se but more of a README/documentation suggestion.
That concerns the example(s) on the README/USE_CASES.
The basic example is this:
But reading this makes me think it's a synchronous code which is fine but I didn't realise it was returning a
Promise
until running it live on Node v11.I'm aware of the callback version:
And that there's
then
able use cases here and here that uses:But if someone runs an async code without rejection handling (so not using either
try { await ... } catch (err) { ... }
in ES8 orPromise.catch(...)
in ES6) it can be noisy and possibly leave room for bugs and errors if someone were to use the package without a proper error handling mechanism.So for example having this:
Technical details:
@sendgrid/[email protected]
The text was updated successfully, but these errors were encountered: