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.
This commit is contained in:
parent
d02bebc6e2
commit
dbfae5cdad
@ -43,10 +43,7 @@ public static class JsonExtensions
|
|||||||
{
|
{
|
||||||
return JsonToDynamic(JsonSerializer.Deserialize<JsonElement>(str));
|
return JsonToDynamic(JsonSerializer.Deserialize<JsonElement>(str));
|
||||||
}
|
}
|
||||||
catch
|
catch { }
|
||||||
{
|
|
||||||
return str; // Not valid JSON, return original string
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return str;
|
return str;
|
||||||
default:
|
default:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user