Skip to content

Commit a46cf10

Browse files
committed
fix: handle validation errors differently for LMStudio vs other embedders
- LMStudio tests expect translation keys for generic errors - Ollama tests expect the actual error message to be preserved - Updated validation-helpers to check embedder type and handle accordingly
1 parent cc5920a commit a46cf10

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/services/code-index/shared/validation-helpers.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,17 @@ export function handleValidationError(
146146
}
147147
}
148148

149-
// For generic errors, always return the translation key for consistency with tests
149+
// For generic errors, check if it's a meaningful error message
150+
if (errorMessage && errorMessage !== "Unknown error") {
151+
// For LMStudio, we need to return the translation key
152+
if (embedderType === "lmstudio") {
153+
return { valid: false, error: "embeddings:validation.configurationError" }
154+
}
155+
// For other embedders, preserve the original error message
156+
return { valid: false, error: errorMessage }
157+
}
158+
159+
// Fallback to generic error
150160
return { valid: false, error: "embeddings:validation.configurationError" }
151161
}
152162

0 commit comments

Comments
 (0)