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
This commit is contained in:
AlexKucera committed 2025-10-24 15:16:23 +02:00
1 parent 0f3d6ec7a3
commit ee892b3231
1 file changed
+2
+2
View File
@@ -66,6 +66,8 @@ export class AnthropicClient {
if (enableCommentary) { if (enableCommentary) {
if (commentaryStyle === 'custom' && customCommentaryPrompt) { if (commentaryStyle === 'custom' && customCommentaryPrompt) {
commentaryPrompt = customCommentaryPrompt; commentaryPrompt = customCommentaryPrompt;
} else if (commentaryStyle === 'custom') {
throw new Error('Custom commentary prompt is required when using custom style');
} else { } else {
commentaryPrompt = COMMENTARY_PRESETS[commentaryStyle as Exclude<CommentaryStyle, 'custom'>]; commentaryPrompt = COMMENTARY_PRESETS[commentaryStyle as Exclude<CommentaryStyle, 'custom'>];
} }