refactor: consolidate failure classification constructors

This commit is contained in:
Tom Boucher
2026-05-04 20:02:38 -04:00
parent ccda572ade
commit 7dcafbc211
5 changed files with 14 additions and 20 deletions

View File

@@ -21,12 +21,6 @@ export function isTimeoutMessage(message: string): boolean {
return /timed out after/i.test(message);
}
export function isTimeoutLikeError(error: unknown): boolean {
if (!(error instanceof Error)) return false;
if (error.name === 'TimeoutError' || error.name === 'AbortError') return true;
return isTimeoutMessage(error.message);
}
export function timeoutMessage(command: string, args: string[], timeoutMs: number): string {
return `gsd-tools timed out after ${timeoutMs}ms: ${command} ${args.join(' ')}`;
}