From dbfae5cdad8c451f26dde0cd036523b2feffe09e Mon Sep 17 00:00:00 2001 From: TekH Date: Thu, 4 Dec 2025 13:54:48 +0100 Subject: [PATCH] Refactor error handling in JsonExtensions Replaced the `catch` block in the `JsonExtensions` class to suppress exceptions silently instead of returning the original string when JSON deserialization fails. The `return str;` statement was moved outside the `try-catch` block, making it the default return value. This change removes explicit handling of invalid JSON inputs and may impact debugging. --- src/ReC.API/Extensions/JsonExtensions.cs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/ReC.API/Extensions/JsonExtensions.cs b/src/ReC.API/Extensions/JsonExtensions.cs index 95d3140..3948d03 100644 --- a/src/ReC.API/Extensions/JsonExtensions.cs +++ b/src/ReC.API/Extensions/JsonExtensions.cs @@ -43,10 +43,7 @@ public static class JsonExtensions { return JsonToDynamic(JsonSerializer.Deserialize(str)); } - catch - { - return str; // Not valid JSON, return original string - } + catch { } } return str; default: