feat(app/actions): display plugins errors in logs (#1023) [skip ci]
This commit is contained in:
@@ -6,6 +6,7 @@ import processes from "child_process"
|
||||
import fs from "fs/promises"
|
||||
import paths from "path"
|
||||
import sgit from "simple-git"
|
||||
import util from "util"
|
||||
import mocks from "../../../tests/mocks/index.mjs"
|
||||
import metrics from "../metrics/index.mjs"
|
||||
import presets from "../metrics/presets.mjs"
|
||||
@@ -392,7 +393,12 @@ function quit(reason) {
|
||||
info.break()
|
||||
info.section("Rendering")
|
||||
let rendered = await retry(async () => {
|
||||
const {rendered} = await metrics({login: user, q}, {graphql, rest, plugins, conf, die, verify, convert}, {Plugins, Templates})
|
||||
const {rendered, errors} = await metrics({login: user, q}, {graphql, rest, plugins, conf, die, verify, convert}, {Plugins, Templates})
|
||||
if (errors.length) {
|
||||
console.warn(`::group::${errors.length} error(s) occured`)
|
||||
console.warn(util.inspect(errors, {depth: Infinity, maxStringLength: 256}))
|
||||
console.warn("::endgroup::")
|
||||
}
|
||||
return rendered
|
||||
}, {retries, delay: retries_delay})
|
||||
if (!rendered)
|
||||
|
||||
@@ -89,7 +89,7 @@ export default async function metrics({login, q}, {graphql, rest, plugins, conf,
|
||||
}
|
||||
return value
|
||||
}))
|
||||
return {rendered, mime: "application/json"}
|
||||
return {rendered, mime: "application/json", errors}
|
||||
}
|
||||
|
||||
//Markdown output
|
||||
@@ -161,7 +161,7 @@ export default async function metrics({login, q}, {graphql, rest, plugins, conf,
|
||||
rest,
|
||||
})
|
||||
}
|
||||
return {rendered, mime: "text/html"}
|
||||
return {rendered, mime: "text/html", errors}
|
||||
}
|
||||
|
||||
//Rendering
|
||||
@@ -197,7 +197,7 @@ export default async function metrics({login, q}, {graphql, rest, plugins, conf,
|
||||
|
||||
//Result
|
||||
console.debug(`metrics/compute/${login} > success`)
|
||||
return {rendered, mime}
|
||||
return {rendered, mime, errors}
|
||||
}
|
||||
//Internal error
|
||||
catch (error) {
|
||||
|
||||
Reference in New Issue
Block a user