Files
AnyPS5/demo/web/failure-report.mjs
T
ebosido444-ai 6252b18b81 fix(web): keep the failure report with a failed conversion
A failed inspect or conversion hid the progress panel that held the
conversion log, cleared the selected archives and showed a single line,
so the only evidence of the failure was gone and a multi-GB input had to
be picked again. Compose the message with the phase, the current input,
the target, the libraries tag and the last 150 log lines, and show it in
the error box under "Failure details" so it can be copied into a report.

The report is a pure function in failure-report.mjs and is covered by
node tests.
2026-10-27 07:52:34 +01:00

15 lines
605 B
JavaScript

const LOG_TAIL = 150;
export function failureReport({ message, phase, input, target, release, log }) {
const context = [];
if (phase) context.push(`Phase: ${phase}`);
if (input) context.push(`Input: ${input}`);
if (target) context.push(`Target: ${target}`);
if (release?.tag) context.push(`Libraries: ${release.tag}`);
const tail = (log ?? []).slice(-LOG_TAIL);
const sections = [String(message)];
if (context.length) sections.push(context.join("\n"));
if (tail.length) sections.push(`Conversion log (last ${tail.length} lines):\n${tail.join("\n")}`);
return sections.join("\n\n");
}