-
-
Notifications
You must be signed in to change notification settings - Fork 32.2k
Closed
Labels
async_hooksIssues and PRs related to the async hooks subsystem.Issues and PRs related to the async hooks subsystem.
Description
While going through the test coverage, I noticed that the else
branch is actually not covered in the test case here
node/lib/internal/async_hooks.js
Lines 160 to 174 in 17a527e
function fatalError(e) { | |
if (typeof e.stack === 'string') { | |
process._rawDebug(e.stack); | |
} else { | |
const o = { message: e }; | |
ErrorCaptureStackTrace(o, fatalError); | |
process._rawDebug(o.stack); | |
} | |
const { getOptionValue } = require('internal/options'); | |
if (getOptionValue('--abort-on-uncaught-exception')) { | |
process.abort(); | |
} | |
process.exit(1); | |
} |
Will the else case ever happened? According to the Node.js docs here, error.stack
is always a string
. So why would we ever do a check on that portion and have an else
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.
Metadata
Metadata
Assignees
Labels
async_hooksIssues and PRs related to the async hooks subsystem.Issues and PRs related to the async hooks subsystem.