From aaf9c5af33bec855dd31037b5fa2d5d69c6d3c81 Mon Sep 17 00:00:00 2001 From: Sean Goedecke Date: Tue, 5 Aug 2025 11:51:50 +1000 Subject: [PATCH] Update src/prompt.ts Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- src/prompt.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/prompt.ts b/src/prompt.ts index 2af78e4..f4f367e 100644 --- a/src/prompt.ts +++ b/src/prompt.ts @@ -61,7 +61,13 @@ export function parseFileTemplateVariables(fileInput: string): TemplateVariables if (!fs.existsSync(filePath)) { throw new Error(`File for template variable '${key}' was not found: ${filePath}`) } - result[key] = fs.readFileSync(filePath, 'utf-8') + try { + result[key] = fs.readFileSync(filePath, 'utf-8') + } catch (err) { + throw new Error( + `Failed to read file for template variable '${key}' at path '${filePath}': ${err instanceof Error ? err.message : 'Unknown error'}` + ) + } } return result