Skip to content

Commit

Permalink
fix: catch deserialization errors in fxtwitter client
Browse files Browse the repository at this point in the history
  • Loading branch information
Sn0wCrack committed Oct 19, 2023
1 parent 302f8a9 commit 53854dd
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion SaucyBot/Library/Sites/Twitter/FxTwitterClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,19 @@ public FxTwitterClient(ILogger<FxTwitterClient> logger, ICacheManager cacheManag
async () => await _client.GetStringAsync($"{BaseUrl}/{name}/status/{identifier}")
);

return response is null ? null : JsonSerializer.Deserialize<FxTwitterResponse>(response);
if (response is null)
{
return null;
}

try
{
return JsonSerializer.Deserialize<FxTwitterResponse>(response);
}
catch (Exception)
{
return null;
}
}
}

Expand Down

0 comments on commit 53854dd

Please sign in to comment.