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 fs from "fs/promises"
|
||||||
import paths from "path"
|
import paths from "path"
|
||||||
import sgit from "simple-git"
|
import sgit from "simple-git"
|
||||||
|
import util from "util"
|
||||||
import mocks from "../../../tests/mocks/index.mjs"
|
import mocks from "../../../tests/mocks/index.mjs"
|
||||||
import metrics from "../metrics/index.mjs"
|
import metrics from "../metrics/index.mjs"
|
||||||
import presets from "../metrics/presets.mjs"
|
import presets from "../metrics/presets.mjs"
|
||||||
@@ -392,7 +393,12 @@ function quit(reason) {
|
|||||||
info.break()
|
info.break()
|
||||||
info.section("Rendering")
|
info.section("Rendering")
|
||||||
let rendered = await retry(async () => {
|
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
|
return rendered
|
||||||
}, {retries, delay: retries_delay})
|
}, {retries, delay: retries_delay})
|
||||||
if (!rendered)
|
if (!rendered)
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ export default async function metrics({login, q}, {graphql, rest, plugins, conf,
|
|||||||
}
|
}
|
||||||
return value
|
return value
|
||||||
}))
|
}))
|
||||||
return {rendered, mime: "application/json"}
|
return {rendered, mime: "application/json", errors}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Markdown output
|
//Markdown output
|
||||||
@@ -161,7 +161,7 @@ export default async function metrics({login, q}, {graphql, rest, plugins, conf,
|
|||||||
rest,
|
rest,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
return {rendered, mime: "text/html"}
|
return {rendered, mime: "text/html", errors}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Rendering
|
//Rendering
|
||||||
@@ -197,7 +197,7 @@ export default async function metrics({login, q}, {graphql, rest, plugins, conf,
|
|||||||
|
|
||||||
//Result
|
//Result
|
||||||
console.debug(`metrics/compute/${login} > success`)
|
console.debug(`metrics/compute/${login} > success`)
|
||||||
return {rendered, mime}
|
return {rendered, mime, errors}
|
||||||
}
|
}
|
||||||
//Internal error
|
//Internal error
|
||||||
catch (error) {
|
catch (error) {
|
||||||
|
|||||||
Reference in New Issue
Block a user