2026-10-07 05:24:32 +08:00
|
|
|
import { ArtifactOperationError } from "./artifactOperationError.js";
|
2026-10-11 06:30:39 +08:00
|
|
|
import type { AnalysisErrorOptions } from "./analysisErrorBase.js";
|
2026-10-07 05:24:32 +08:00
|
|
|
|
|
|
|
|
/** Publication failure retaining its input/output target and cleanup state. */
|
|
|
|
|
export class WebScriptExportError extends ArtifactOperationError {
|
|
|
|
|
override readonly userMessage: string;
|
2026-10-14 04:47:34 +08:00
|
|
|
override cleanupIncomplete: boolean;
|
2026-10-07 05:24:32 +08:00
|
|
|
|
|
|
|
|
constructor(
|
|
|
|
|
reason: ArtifactOperationError["reason"],
|
|
|
|
|
target: string,
|
|
|
|
|
diagnostic: string,
|
2026-10-11 06:30:39 +08:00
|
|
|
options: AnalysisErrorOptions & {
|
|
|
|
|
readonly residualPaths?: readonly string[];
|
|
|
|
|
} = {},
|
2026-10-07 05:24:32 +08:00
|
|
|
) {
|
2026-10-11 06:30:39 +08:00
|
|
|
super("export_web_scripts", reason, undefined, undefined, options);
|
2026-10-07 05:24:32 +08:00
|
|
|
this.userMessage = `Script export failed for ${target}: ${diagnostic}`;
|
2026-10-17 04:20:07 +08:00
|
|
|
this.setCleanupResources([
|
2026-10-11 06:30:39 +08:00
|
|
|
...new Set([
|
|
|
|
|
...(options.cleanup?.resources ?? []),
|
|
|
|
|
...(options.residualPaths ?? []),
|
|
|
|
|
]),
|
2026-10-17 04:20:07 +08:00
|
|
|
]);
|
2026-10-11 06:30:39 +08:00
|
|
|
this.cleanupIncomplete =
|
|
|
|
|
options.cleanup !== undefined || (options.residualPaths?.length ?? 0) > 0;
|
2026-10-07 05:24:32 +08:00
|
|
|
}
|
|
|
|
|
}
|