fix(web)!: retain capture read cleanup through export
BREAKING CHANGE: WebScriptExportError accepts error context and residual paths in an options object.
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { ArtifactOperationError } from "./artifactOperationError.js";
|
||||
import type { AnalysisErrorOptions } from "./analysisErrorBase.js";
|
||||
|
||||
/** Publication failure retaining its input/output target and cleanup state. */
|
||||
export class WebScriptExportError extends ArtifactOperationError {
|
||||
@@ -10,11 +11,19 @@ export class WebScriptExportError extends ArtifactOperationError {
|
||||
reason: ArtifactOperationError["reason"],
|
||||
target: string,
|
||||
diagnostic: string,
|
||||
residualPaths: readonly string[] = [],
|
||||
options: AnalysisErrorOptions & {
|
||||
readonly residualPaths?: readonly string[];
|
||||
} = {},
|
||||
) {
|
||||
super("export_web_scripts", reason);
|
||||
super("export_web_scripts", reason, undefined, undefined, options);
|
||||
this.userMessage = `Script export failed for ${target}: ${diagnostic}`;
|
||||
this.cleanupResources = residualPaths;
|
||||
this.cleanupIncomplete = residualPaths.length > 0;
|
||||
this.cleanupResources = [
|
||||
...new Set([
|
||||
...(options.cleanup?.resources ?? []),
|
||||
...(options.residualPaths ?? []),
|
||||
]),
|
||||
];
|
||||
this.cleanupIncomplete =
|
||||
options.cleanup !== undefined || (options.residualPaths?.length ?? 0) > 0;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user