-
Notifications
You must be signed in to change notification settings - Fork 30k
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
async_hooks: fatalError(e)
function checking error Object
#38077
Comments
The if-else is check if e.stack is string according to Node.js docs, e.stack is always a string, so there is no need for this check Refs: nodejs#38077
FYI: this branch was brought with initial implementation #12892 I don't know the exact reason. May it need view from author? |
I think that this was the reasoning : #11883 (comment), to filter "real" Errors |
cc @nodejs/async_hooks as I'm unlikely to look at this. |
That's true for |
True enough on throwing I'm not entirely sure of the intention here. |
@Flarna @Darkripper214 A fatal error here is just any error thrown in an async_hooks callback. So yes, |
@Darkripper214 The if path handles anything thrown which has a The else path takes care about all the rest (e.g. If you remove the else branch and for whatever reason someone throws a non But I think we should change |
@Flarna Thanks for the clarification. So I was misunderstanding the functionality of I think this had turned into an issue for the |
While going through the test coverage, I noticed that the
else
branch is actually not covered in the test case herenode/lib/internal/async_hooks.js
Lines 160 to 174 in 17a527e
Will the else case ever happened? According to the Node.js docs here,
error.stack
is always astring
. So why would we ever do a check on that portion and have anelse
branch?From what I understand,
fatalError(e)
is only used to capture error when the callback from the registered hooks failed and it doesn't seem necessary in this case.Let me know what you think.
The text was updated successfully, but these errors were encountered: