-
Notifications
You must be signed in to change notification settings - Fork 0
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
Throw and try/catch #2
Comments
Good advice here: https://stackoverflow.com/a/52215925/922323 |
This talks about how to use top-level caller: |
This is interesting: https://makandracards.com/makandra/43653-javascript-don-t-throw-exceptions-from-async-functions
|
I need to make a readme wiki repo on exception handling, just for my own education. This shit is probably one of the more complex/ambiguous feature(?) of es6+ (in my mind). Just need more practice. :) |
Looks like thowing a new error will result in a rejected promise in a async/await. |
A few good paragraphs about constructors and async operations; basically, don't do that in constructor. |
Great tips here: https://eloquentjavascript.net/08_error.html
|
Good tips here: |
Returning a promise from async will not double wrap the promise: https://stackoverflow.com/a/35302535/922323 Non-promise return will be wrapped. No return will return a promise. |
Use just throw and try/catch around awaits:
basic-node-module/index.js
Lines 51 to 65 in 5df8ced
Here's example of just throw:
https://github.com/mhulse/get-tile-url/blob/f79b35889e0ad43fda12053cd1d2a1dcd8ef3b61/index.js#L90
The text was updated successfully, but these errors were encountered: