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}))
}
}
}

View File

@@ -6,7 +6,7 @@
if ((!enabled)||(!q.habits))
return null
//Parameters override
let {"habits.from":from = defaults.from ?? 500, "habits.days":days = 30, "habits.facts":facts = true, "habits.charts":charts = false} = q
let {"habits.from":from = defaults.from ?? 500, "habits.days":days = 14, "habits.facts":facts = true, "habits.charts":charts = false} = q
//Events
from = Math.max(1, Math.min(1000, Number(from)))
//Days