refactor: introduce explicit query error seam contracts

This commit is contained in:
Tom Boucher
2026-05-04 20:12:11 -04:00
parent c7d3f83b8b
commit b9e3979fc1
5 changed files with 55 additions and 33 deletions

View File

@@ -0,0 +1,28 @@
import type { GSDToolsError } from './gsd-tools-error.js';
export interface QueryTimeoutErrorFactory {
createTimeoutError: (
message: string,
command: string,
args: string[],
stderr: string,
timeoutMs: number,
) => GSDToolsError;
}
export interface QueryFailureErrorFactory {
createFailureError: (
message: string,
command: string,
args: string[],
exitCode: number | null,
stderr: string,
) => GSDToolsError;
}
export type QueryToolsErrorFactory = QueryTimeoutErrorFactory & QueryFailureErrorFactory;
export interface QueryNativeErrorFactory {
createNativeTimeoutError: (message: string, command: string, args: string[]) => GSDToolsError;
createNativeFailureError: (message: string, command: string, args: string[], cause: unknown) => GSDToolsError;
}