diff options
author | Emma [it/its]@Rory& <root@rory.gay> | 2024-06-19 23:19:16 +0200 |
---|---|---|
committer | Emma [it/its]@Rory& <root@rory.gay> | 2024-06-19 23:19:16 +0200 |
commit | 16e314ed714f8b3e298c0ecf2ebfe67b48e5f697 (patch) | |
tree | 55f9bc3834ae0cb5f6c506d9e03cc7d5626e0640 /LibMatrix/Extensions/MatrixHttpClient.Single.cs | |
parent | Single HTTP client fixes (diff) | |
download | LibMatrix-16e314ed714f8b3e298c0ecf2ebfe67b48e5f697.tar.xz |
Return null on TryGetFromJson if a JsonException happens github/dev/e2ee dev/e2ee
Diffstat (limited to '')
-rw-r--r-- | LibMatrix/Extensions/MatrixHttpClient.Single.cs | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/LibMatrix/Extensions/MatrixHttpClient.Single.cs b/LibMatrix/Extensions/MatrixHttpClient.Single.cs index e722370..c9cd260 100644 --- a/LibMatrix/Extensions/MatrixHttpClient.Single.cs +++ b/LibMatrix/Extensions/MatrixHttpClient.Single.cs @@ -146,6 +146,10 @@ public class MatrixHttpClient { try { return await GetFromJsonAsync<T>(requestUri, options, cancellationToken); } + catch (JsonException e) { + Console.WriteLine($"Failed to deserialize response from {requestUri}: {e.Message}"); + return default; + } catch (HttpRequestException e) { Console.WriteLine($"Failed to get {requestUri}: {e.Message}"); return default; |