refactor: deepen GSDTools query execution seams (#3085)

* refactor: deepen gsdtools query execution seams

* docs: add changeset for query seam deepening

* docs: fix changeset summary text

* fix: address coderabbit query seam findings

* test: address remaining coderabbit findings and notes

* refactor: use internal gsdtools error type import
This commit is contained in:
Tom Boucher
2026-05-03 18:56:41 -04:00
committed by GitHub
parent 5e21bf7567
commit 42ed7cee8d
24 changed files with 871 additions and 445 deletions

View File

@@ -0,0 +1,28 @@
import { GSDError, exitCodeFor } from './errors.js';
import { GSDToolsError } from './gsd-tools-error.js';
/**
* Module owning projection of internal errors to GSDToolsError contract.
*/
export function toGSDToolsError(command: string, args: string[], err: unknown): GSDToolsError {
if (err instanceof GSDError) {
return new GSDToolsError(
err.message,
command,
args,
exitCodeFor(err.classification),
'',
{ cause: err },
);
}
const msg = err instanceof Error ? err.message : String(err);
return new GSDToolsError(
msg,
command,
args,
1,
'',
err instanceof Error ? { cause: err } : undefined,
);
}