File tree 3 files changed +18
-1
lines changed
3 files changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -558,6 +558,7 @@ found [here][online].
558
558
encountered by [ ` http ` ] [ ] or [ ` net ` ] [ ] -- often a sign that a ` socket.end() `
559
559
was not properly called.
560
560
561
+
561
562
<a id =" nodejs-error-codes " ></a >
562
563
## Node.js Error Codes
563
564
@@ -587,6 +588,14 @@ An error using the `'ERR_STDOUT_CLOSE'` code is thrown specifically when an
587
588
attempt is made to close the ` process.stdout ` stream. By design, Node.js does
588
589
not allow ` stdout ` or ` stderr ` Streams to be closed by user code.
589
590
591
+ <a id =" ERR_UNKNOWN_BUILTIN_MODULE " ></a >
592
+ ### ERR_UNKNOWN_BUILTIN_MODULE
593
+
594
+ The ` 'ERR_UNKNOWN_BUILTIN_MODULE' ` error code is used to identify a specific
595
+ kind of internal Node.js error that should not typically be triggered by user
596
+ code. Instances of this error point to an internal bug within the Node.js
597
+ binary itself.
598
+
590
599
<a id =" ERR_UNKNOWN_STDIN_TYPE " ></a >
591
600
### ERR_UNKNOWN_STDIN_TYPE
592
601
@@ -605,6 +614,7 @@ an attempt is made to launch a Node.js process with an unknown `stdout` or
605
614
in user code, although it is not impossible. Occurrences of this error are most
606
615
likely an indication of a bug within Node.js itself.
607
616
617
+
608
618
[ `fs.readdir` ] : fs.html#fs_fs_readdir_path_options_callback
609
619
[ `fs.readFileSync` ] : fs.html#fs_fs_readfilesync_file_options
610
620
[ `fs.unlink` ] : fs.html#fs_fs_unlink_path_callback
Original file line number Diff line number Diff line change 462
462
}
463
463
464
464
if ( ! NativeModule . exists ( id ) ) {
465
- throw new Error ( `No such native module ${ id } ` ) ;
465
+ // Model the error off the internal/errors.js model, but
466
+ // do not use that module given that it could actually be
467
+ // the one causing the error if there's a bug in Node.js
468
+ const err = new Error ( `No such built-in module: ${ id } ` ) ;
469
+ err . code = 'ERR_UNKNOWN_BUILTIN_MODULE' ;
470
+ err . name = 'Error [ERR_UNKNOWN_BUILTIN_MODULE]' ;
471
+ throw err ;
466
472
}
467
473
468
474
process . moduleLoadList . push ( `NativeModule ${ id } ` ) ;
Original file line number Diff line number Diff line change @@ -86,6 +86,7 @@ E('ERR_STDERR_CLOSE', 'process.stderr cannot be closed');
86
86
E ( 'ERR_STDOUT_CLOSE' , 'process.stdout cannot be closed' ) ;
87
87
E ( 'ERR_UNKNOWN_STDIN_TYPE' , 'Unknown stdin file type' ) ;
88
88
E ( 'ERR_UNKNOWN_STREAM_TYPE' , 'Unknown stream file type' ) ;
89
+ E ( 'ERR_UNKNOWN_BUILTIN_MODULE' , ( id ) => `No such built-in module: ${ id } ` ) ;
89
90
// Add new errors from here...
90
91
91
92
function invalidArgType ( name , expected , actual ) {
You can’t perform that action at this time.
0 commit comments