From 09d709966b44fec1c602c8193b858178cc84a36f Mon Sep 17 00:00:00 2001 From: LD-Reborn Date: Sat, 13 Dec 2025 17:05:56 +0100 Subject: [PATCH] Fixed missing proper exception in AIProvider --- src/Server/AIProvider.cs | 2 +- .../{SearchdomainExceptions.cs => GeneralExceptions.cs} | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) rename src/Server/Exceptions/{SearchdomainExceptions.cs => GeneralExceptions.cs} (59%) diff --git a/src/Server/AIProvider.cs b/src/Server/AIProvider.cs index 323db4f..0a244a2 100644 --- a/src/Server/AIProvider.cs +++ b/src/Server/AIProvider.cs @@ -106,7 +106,7 @@ public class AIProvider if (responseContentTokens is null) { _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()]; } diff --git a/src/Server/Exceptions/SearchdomainExceptions.cs b/src/Server/Exceptions/GeneralExceptions.cs similarity index 59% rename from src/Server/Exceptions/SearchdomainExceptions.cs rename to src/Server/Exceptions/GeneralExceptions.cs index 7384532..e5a37b1 100644 --- a/src/Server/Exceptions/SearchdomainExceptions.cs +++ b/src/Server/Exceptions/GeneralExceptions.cs @@ -2,4 +2,6 @@ namespace Server.Exceptions; public class ProbMethodNotFoundException(string probMethod) : Exception($"Unknown probMethod name {probMethod}") { } -public class SimilarityMethodNotFoundException(string similarityMethod) : Exception($"Unknown similarityMethod name \"{similarityMethod}\"") { } \ No newline at end of file +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}.") { } \ No newline at end of file