Logs plugins errors as warning even if debug option isn't enabled

This commit is contained in:
linguist
2020-12-28 00:47:37 +01:00
parent b252ed129b
commit 5c8fa3a6f6
4 changed files with 35 additions and 29 deletions

View File

@@ -58,10 +58,16 @@
const promised = await Promise.all(pending)
//Check plugins errors
if (die) {
const errors = promised.filter(({result = null}) => !!result?.error).length
if (errors)
throw new Error(`${errors} error${s(errors)} found...`)
{
const errors = promised.filter(({result = null}) => result?.error)
if (die) {
if (errors.length)
throw new Error(`${errors.length} error${s(errors.length)} found...`)
}
else {
console.warn(`${errors.length} error${s(errors.length)} found, ignoring...`)
console.warn(util.inspect(errors, {depth:Infinity, maxStringLength:256}))
}
}
}