-
-
Notifications
You must be signed in to change notification settings - Fork 34.2k
Closed
Labels
docIssues and PRs related to the documentations.Issues and PRs related to the documentations.
Description
Certain library objects that extend EventEmitter emits error on callback that are not caught by a try/catch or Promise. If it is not possible to address this in code somehow, those objects and methods should be marked in the documentation as requiring an error listener.
IMPACT:
Node.js throws uncaught exception in edge-case situations
Example 1: failing dns request
node --eval "new Promise(r => new (require('http').Server)().listen(0, '#$%'))"
events.js:160
throw er; // Unhandled 'error' event
^
Error: getaddrinfo ENOTFOUND #$%
at errnoException (dns.js:28:10)
at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:79:26)Example 2: failed spawn
node --eval "new Promise(r => require('child_process').spawn('error factory'))"
events.js:160
throw er; // Unhandled 'error' event
^
Error: spawn error factory ENOENT
at exports._errnoException (util.js:1026:11)
at Process.ChildProcess._handle.onexit (internal/child_process.js:182:32)
at onErrorNT (internal/child_process.js:348:16)
at _combinedTickCallback (internal/process/next_tick.js:74:11)
at process._tickCallback (internal/process/next_tick.js:98:9)uname --all && node --version
Linux c89 4.4.0-34-generic #53-Ubuntu SMP Wed Jul 27 16:06:39 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
v6.4.0
Metadata
Metadata
Assignees
Labels
docIssues and PRs related to the documentations.Issues and PRs related to the documentations.