mirror of
https://github.com/nodejs/node.git
synced 2026-11-30 11:55:44 -05:00
net: add comments explaining error check
PR-URL: https://github.com/nodejs/node/pull/24222 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
This commit is contained in:
1 parent
2d0105c751
commit
0c2d1d57e8
1 file changed
+7
@@ -263,9 +263,16 @@ function Socket(options) {
|
||||
const { fd } = options;
|
||||
let err;
|
||||
|
||||
// createHandle will throw ERR_INVALID_FD_TYPE if `fd` is not
|
||||
// a valid `PIPE` or `TCP` descriptor
|
||||
this._handle = createHandle(fd, false);
|
||||
|
||||
err = this._handle.open(fd);
|
||||
|
||||
// While difficult to fabricate, in some architectures
|
||||
// `open` may return an error code for valid file descriptors
|
||||
// which cannot be opened. This is difficult to test as most
|
||||
// un-openable fds will throw on `createHandle`
|
||||
if (err)
|
||||
throw errnoException(err, 'open');
|
||||
|
||||
|
||||
Reference in new issue
Block a user