Fixed missing proper exception in AIProvider

This commit is contained in:
2025-12-13 17:05:56 +01:00
parent a1ed65ee41
commit 09d709966b
2 changed files with 4 additions and 2 deletions

View File

@@ -106,7 +106,7 @@ public class AIProvider
if (responseContentTokens is null) if (responseContentTokens is null)
{ {
_logger.LogError("Unable to select tokens using JSONPath {embeddingsJsonPath} for string: {responseContent}.", [embeddingsJsonPath, responseContent]); _logger.LogError("Unable to select tokens using JSONPath {embeddingsJsonPath} for string: {responseContent}.", [embeddingsJsonPath, responseContent]);
throw new Exception($"Unable to select tokens using JSONPath {embeddingsJsonPath} for string: {responseContent}."); // TODO add proper exception throw new JSONPathSelectionException(embeddingsJsonPath, responseContent);
} }
return [.. responseContentTokens.Values<float>()]; return [.. responseContentTokens.Values<float>()];
} }

View File

@@ -3,3 +3,5 @@ namespace Server.Exceptions;
public class ProbMethodNotFoundException(string probMethod) : Exception($"Unknown probMethod name {probMethod}") { } public class ProbMethodNotFoundException(string probMethod) : Exception($"Unknown probMethod name {probMethod}") { }
public class SimilarityMethodNotFoundException(string similarityMethod) : Exception($"Unknown similarityMethod name \"{similarityMethod}\"") { } public class SimilarityMethodNotFoundException(string similarityMethod) : Exception($"Unknown similarityMethod name \"{similarityMethod}\"") { }
public class JSONPathSelectionException(string path, string testedContent) : Exception($"Unable to select tokens using JSONPath {path} for string: {testedContent}.") { }