-
Notifications
You must be signed in to change notification settings - Fork 29.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bootstrap: usable error on missing internal module #29593
bootstrap: usable error on missing internal module #29593
Conversation
I’m okay with fast-tracking this if you like. |
Hmm, guess I forgot to run tests / lint last minute? (I swear I did...)
Not exactly useful here, what's the best way to exclude this rule from this file entirely? |
i'd just |
add9401
to
17df5b6
Compare
Due to how bootstrap/loaders.js itself is loaded and invoked, stacktraces from it are munged and no longer point back to the error source. That resulted in the following unhelpful error if an internal module was missing or misnamed: ``` internal/bootstrap/loaders.js:190 return mod.compile(); ^ TypeError: Cannot read property 'compile' of undefined ``` This changes that to at least print the id that was attempted to be loaded: ``` internal/bootstrap/loaders.js:189 if (!mod) throw new TypeError(`Missing internal module '${id}'`); ^ TypeError: Missing internal module 'internal/a' ```
17df5b6
to
9f804d1
Compare
Landed in 4d798e1 |
Due to how bootstrap/loaders.js itself is loaded and invoked, stacktraces from it are munged and no longer point back to the error source. That resulted in the following unhelpful error if an internal module was missing or misnamed: ``` internal/bootstrap/loaders.js:190 return mod.compile(); ^ TypeError: Cannot read property 'compile' of undefined ``` This changes that to at least print the id that was attempted to be loaded: ``` internal/bootstrap/loaders.js:189 if (!mod) throw new TypeError(`Missing internal module '${id}'`); ^ TypeError: Missing internal module 'internal/a' ``` PR-URL: #29593 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
(I actually think TypeError was the wrong choice, but ok, it probably doesn’t matter..) |
This only works specifically for the errors caused by incorrect internal module ids (however throwing here right after failure of lookup with the module id in the message still SGTM). #29624 should help printing stack traces for all kinds of errors thrown during bootstrap. |
Due to how bootstrap/loaders.js itself is loaded and invoked, stacktraces from it are munged and no longer point back to the error source. That resulted in the following unhelpful error if an internal module was missing or misnamed: ``` internal/bootstrap/loaders.js:190 return mod.compile(); ^ TypeError: Cannot read property 'compile' of undefined ``` This changes that to at least print the id that was attempted to be loaded: ``` internal/bootstrap/loaders.js:189 if (!mod) throw new TypeError(`Missing internal module '${id}'`); ^ TypeError: Missing internal module 'internal/a' ``` PR-URL: #29593 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
So that the stack trace of errors shown in internal code run during bootstrap (before process._fatalException is set) can be printed. PR-URL: nodejs#29624 Refs: nodejs#29593 Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Due to how bootstrap/loaders.js itself is loaded and invoked, stacktraces from it are munged and no longer point back to the error source. That resulted in the following unhelpful error if an internal module was missing or misnamed: ``` internal/bootstrap/loaders.js:190 return mod.compile(); ^ TypeError: Cannot read property 'compile' of undefined ``` This changes that to at least print the id that was attempted to be loaded: ``` internal/bootstrap/loaders.js:189 if (!mod) throw new TypeError(`Missing internal module '${id}'`); ^ TypeError: Missing internal module 'internal/a' ``` PR-URL: #29593 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Due to how bootstrap/loaders.js itself is loaded and invoked, stacktraces from it are munged and no longer point back to the error source.
That resulted in the following unhelpful error if an internal module was missing or misnamed:
This changes that to at least print the id that was attempted to be loaded:
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes