Move each error family out of domain/errors.ts into its own module (base, core, provider selection/adapter, browser observation, artifact, evidence, unknown registry, hopper, configuration) and relocate AnalysisErrorProjection to analysisErrorProjection. Migrate all 162 importers to the owning modules and delete errors.ts. No re-export shims; behavior is unchanged.
30 lines
1.1 KiB
TypeScript
30 lines
1.1 KiB
TypeScript
import type {
|
|
BrowserObservationFailureReason,
|
|
BrowserObservationOperation,
|
|
} from "./browserObservationErrors.js";
|
|
import { AnalysisError } from "./analysisErrorBase.js";
|
|
import { AnalysisCancelledError } from "./analysisErrorCore.js";
|
|
|
|
/** A bounded passive browser observation failed at its CDP boundary. */
|
|
export class BrowserObservationError extends AnalysisError {
|
|
readonly _tag = "BrowserObservationError";
|
|
override readonly cleanupIncomplete: boolean;
|
|
override readonly cleanupResources: readonly string[];
|
|
override readonly userCategory: "cancelled" | undefined;
|
|
|
|
constructor(
|
|
readonly operation: BrowserObservationOperation,
|
|
readonly reason: BrowserObservationFailureReason,
|
|
options?: ErrorOptions,
|
|
) {
|
|
super(`Browser observation ${operation} failed: ${reason}`, options);
|
|
this.cleanupIncomplete = reason === "cleanup_failed";
|
|
this.cleanupResources =
|
|
reason === "cleanup_failed" ? ["browser_transport"] : [];
|
|
this.userCategory =
|
|
reason === "cancelled" || options?.cause instanceof AnalysisCancelledError
|
|
? "cancelled"
|
|
: undefined;
|
|
}
|
|
}
|