Skip to content
This repository was archived by the owner on Jul 13, 2020. It is now read-only.

Commit 37c4bf7

Browse files
committed
Merge pull request #188 from johnjbarton/no-module-on-err
Don't create a Module if the evaluation fails.
2 parents d751b21 + cbf08b4 commit 37c4bf7

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/loader.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -807,7 +807,8 @@ function logloads(loads) {
807807
err = doExecute(module);
808808
if (err)
809809
module.failed = true;
810-
module.module = _newModule(module.exports);
810+
else
811+
module.module = _newModule(module.exports);
811812
module.execute = undefined;
812813
return err;
813814
}
@@ -968,7 +969,7 @@ function logloads(loads) {
968969
// 26.3.3.14
969970
set: function(name, module) {
970971
if (!(module instanceof Module))
971-
throw new TypeError('Set must be a module');
972+
throw new TypeError('Loader.set(' + name + ', module) must be a module');
972973
this._loader.modules[name] = {
973974
module: module
974975
};

0 commit comments

Comments
 (0)