Skip to content
Permalink
Browse files
throw error when unexpected state has been found
  • Loading branch information
sokra committed May 27, 2018
1 parent 115a72c commit 7ebe12dde12a62301fb8979917592fdd5a51012a
Showing 1 changed file with 21 additions and 3 deletions.
@@ -65,10 +65,16 @@ module.exports = class RuntimeTemplate {
}

moduleId({ module, request }) {
if (!module)
if (!module) {
return this.missingModule({
request
});
}
if (module.id === null) {
throw new Error(
`RuntimeTemplate.moduleId(): Module ${module.identifier()} has no id. This should not happen.`
);
}
return `${this.comment({ request })}${JSON.stringify(module.id)}`;
}

@@ -105,10 +111,16 @@ module.exports = class RuntimeTemplate {
}

moduleNamespacePromise({ block, module, request, message, strict, weak }) {
if (!module)
if (!module) {
return this.missingModulePromise({
request
});
}
if (module.id === null) {
throw new Error(
`RuntimeTemplate.moduleNamespacePromise(): Module ${module.identifier()} has no id. This should not happen.`
);
}
const promise = this.blockPromise({
block,
message
@@ -151,10 +163,16 @@ module.exports = class RuntimeTemplate {
}

importStatement({ update, module, request, importVar, originModule }) {
if (!module)
if (!module) {
return this.missingModuleStatement({
request
});
}
if (module.id === null) {
throw new Error(
`RuntimeTemplate.importStatement(): Module ${module.identifier()} has no id. This should not happen.`
);
}
const comment = this.comment({
request
});

0 comments on commit 7ebe12d

Please sign in to comment.