From ee892b32311fc962b536e8730e64246d0b788cb6 Mon Sep 17 00:00:00 2001 From: Alexander Kucera Date: Fri, 24 Oct 2025 15:16:23 +0200 Subject: [PATCH] Adds validation for custom commentary style Enforces requirement of custom commentary prompt when custom style is selected Prevents potential runtime errors by throwing an explicit error if custom commentary style is chosen without providing a custom prompt --- api/anthropicClient.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/api/anthropicClient.ts b/api/anthropicClient.ts index 7c9e6a5..bbf0ad6 100644 --- a/api/anthropicClient.ts +++ b/api/anthropicClient.ts @@ -66,6 +66,8 @@ export class AnthropicClient { if (enableCommentary) { if (commentaryStyle === 'custom' && customCommentaryPrompt) { commentaryPrompt = customCommentaryPrompt; + } else if (commentaryStyle === 'custom') { + throw new Error('Custom commentary prompt is required when using custom style'); } else { commentaryPrompt = COMMENTARY_PRESETS[commentaryStyle as Exclude]; }