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.
26 lines
912 B
TypeScript
26 lines
912 B
TypeScript
import type { JsonValue } from "./jsonValue.js";
|
|
import { AnalysisError } from "./analysisErrorBase.js";
|
|
|
|
/** A provider adapter failed outside its more precise typed variants. */
|
|
export interface ProviderAdapterErrorOptions extends ErrorOptions {
|
|
readonly diagnostics?: Readonly<Record<string, JsonValue>>;
|
|
}
|
|
|
|
/** A provider adapter failed outside its more precise typed variants. */
|
|
export class ProviderAdapterError extends AnalysisError {
|
|
readonly _tag = "ProviderAdapterError";
|
|
readonly diagnostics: Readonly<Record<string, JsonValue>> | undefined;
|
|
|
|
constructor(
|
|
readonly providerId: string,
|
|
readonly operation: string,
|
|
options: ProviderAdapterErrorOptions = {},
|
|
) {
|
|
super(`Provider ${providerId} adapter failed during ${operation}`, options);
|
|
this.diagnostics =
|
|
options.diagnostics === undefined
|
|
? undefined
|
|
: structuredClone(options.diagnostics);
|
|
}
|
|
}
|