Skip to content

Commit

Permalink
Show clearer error message when Islamic Finder API service is down
Browse files Browse the repository at this point in the history
  • Loading branch information
Khiro95 committed Mar 19, 2024
1 parent 25a999d commit f14392c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions AwqatSalaat/DataModel/IslamicFinderApi/Client.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ private static async Task<T> GetDataAsync<T>(Request request) where T : Response
if (httpResponse.IsSuccessStatusCode)
{
string responseBody = await httpResponse.Content.ReadAsStringAsync();
if (string.IsNullOrEmpty(responseBody))
{
throw new IslamicFinderApiException("Islamic Finder service did not respond with data.");
}
T apiResponse = JsonConvert.DeserializeObject<T>(responseBody);
if (!apiResponse.Success)
{
Expand Down

0 comments on commit f14392c

Please sign in to comment.