Properly throw an error in compiler even when childCompilation is missing

For some errors, no other parameters to the function are even given,
only the error object in `err`.
This commit is contained in:
Denis Sokolov 2016-02-29 18:12:35 +02:00
parent 4a69c9a013
commit 2fd075ff21
1 changed files with 1 additions and 1 deletions

View File

@ -71,7 +71,7 @@ module.exports.compileTemplate = function compileTemplate (template, context, ou
delete compilation.assets[outputOptions.filename];
}
// Resolve / reject the promise
if (childCompilation.errors && childCompilation.errors.length) {
if (childCompilation && childCompilation.errors && childCompilation.errors.length) {
var errorDetails = childCompilation.errors.map(function (error) {
return error.message + (error.error ? ':\n' + error.error : '');
}).join('\n');