File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -558,6 +558,7 @@ found [here][online].
558558 encountered by [ ` http ` ] [ ] or [ ` net ` ] [ ] -- often a sign that a ` socket.end() `
559559 was not properly called.
560560
561+
561562<a id =" nodejs-error-codes " ></a >
562563## Node.js Error Codes
563564
@@ -587,6 +588,14 @@ An error using the `'ERR_STDOUT_CLOSE'` code is thrown specifically when an
587588attempt is made to close the ` process.stdout ` stream. By design, Node.js does
588589not allow ` stdout ` or ` stderr ` Streams to be closed by user code.
589590
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+
590599<a id =" ERR_UNKNOWN_STDIN_TYPE " ></a >
591600### ERR_UNKNOWN_STDIN_TYPE
592601
@@ -605,6 +614,7 @@ an attempt is made to launch a Node.js process with an unknown `stdout` or
605614in user code, although it is not impossible. Occurrences of this error are most
606615likely an indication of a bug within Node.js itself.
607616
617+
608618[ `fs.readdir` ] : fs.html#fs_fs_readdir_path_options_callback
609619[ `fs.readFileSync` ] : fs.html#fs_fs_readfilesync_file_options
610620[ `fs.unlink` ] : fs.html#fs_fs_unlink_path_callback
Original file line number Diff line number Diff line change 462462 }
463463
464464 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 ;
466472 }
467473
468474 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');
8686E ( 'ERR_STDOUT_CLOSE' , 'process.stdout cannot be closed' ) ;
8787E ( 'ERR_UNKNOWN_STDIN_TYPE' , 'Unknown stdin file type' ) ;
8888E ( 'ERR_UNKNOWN_STREAM_TYPE' , 'Unknown stream file type' ) ;
89+ E ( 'ERR_UNKNOWN_BUILTIN_MODULE' , ( id ) => `No such built-in module: ${ id } ` ) ;
8990// Add new errors from here...
9091
9192function invalidArgType ( name , expected , actual ) {
You can’t perform that action at this time.
0 commit comments