mirror of
https://github.com/boykopovar/AnyPS5.git
synced 2026-10-31 12:35:51 +00:00
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.
15 lines
605 B
JavaScript
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");
|
|
}
|