0
0
mirror of https://github.com/nodejs/node.git synced 2024-12-01 16:10:02 +01:00
nodejs/lib/internal/bootstrap
Jeremiah Senkpiel 4d798e1b1b 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: 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>
2019-09-18 08:18:38 -07:00
..
environment.js process: run RunBootstrapping in CreateEnvironment 2019-04-03 08:46:03 +08:00
loaders.js bootstrap: provide usable error on missing internal module 2019-09-18 08:18:38 -07:00
node.js process: expose uv_rusage on process.resourcesUsage() 2019-07-01 16:02:17 +02:00
pre_execution.js bootstrap: run preload prior to frozen-intrinsics 2019-08-20 09:49:48 -05:00