fix(audit): clarify missing drift artifacts-dir errors

Replace raw ENOENT from drift artifact directory scans with a clear explicit error message containing the resolved path. Architecture/protocol diagrams reviewed; no updates needed.
This commit is contained in:
William Valentin
2026-02-27 13:30:56 -08:00
parent 576b11106f
commit 8818c326b7
2 changed files with 20 additions and 1 deletions
@@ -209,7 +209,15 @@ function buildThresholds(values: Record<string, string | boolean | undefined>):
}
async function readArtifactRecords(artifactsDir: string): Promise<ArtifactRecord[]> {
const files = await readdir(artifactsDir);
let files: string[];
try {
files = await readdir(artifactsDir);
} catch (error) {
if ((error as NodeJS.ErrnoException)?.code === 'ENOENT') {
throw new Error(`Artifacts directory does not exist: ${artifactsDir}`);
}
throw error;
}
const records: ArtifactRecord[] = [];
for (const file of files) {