Commit 4d798e1b authored by Jeremiah Senkpiel's avatar Jeremiah Senkpiel Committed by Rich Trott
Browse files

bootstrap: provide usable error on missing internal module

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: https://github.com/nodejs/node/pull/29593


Reviewed-By: default avatarAnna Henningsen <anna@addaleax.net>
Reviewed-By: default avatarJames M Snell <jasnell@gmail.com>
Reviewed-By: default avatarGus Caplan <me@gus.host>
Reviewed-By: default avatarColin Ihrig <cjihrig@gmail.com>
Reviewed-By: default avatarRuben Bridgewater <ruben@bridgewater.de>
parent 9fb8b8d0
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment