Skip to content

Commit

Permalink
Log request path info when requests fail
Browse files Browse the repository at this point in the history
  • Loading branch information
adlermichal committed Sep 5, 2023
1 parent f9364d6 commit 07b566d
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ internal async Task<long> GetSiteID(CancellationToken? cancellationToken = null)
string requestPath = string.Format(SiteimproveConstants.SITES_PATH, 1);
var sites = await Get<SiteimproveSites>(requestPath, cancellationToken, client);

if (sites == null)
if (sites == null || sites.TotalItems == 0)
{
return siteID;
}
Expand Down Expand Up @@ -219,7 +219,7 @@ private async Task<string> GetTokenInternal(CancellationToken? cancellationToken
}
catch (Exception ex)
{
eventLogService.LogException(nameof(SiteimproveService), nameof(Get), ex);
eventLogService.LogException(nameof(SiteimproveService), nameof(Get), ex, additionalMessage: $"{nameof(Get)} failed. Request path: {requestPath}");
}

return null;
Expand All @@ -236,7 +236,7 @@ private async Task<string> GetTokenInternal(CancellationToken? cancellationToken
}
catch (Exception ex)
{
eventLogService.LogException(nameof(SiteimproveService), nameof(Get), ex);
eventLogService.LogException(nameof(SiteimproveService), nameof(Post), ex, additionalMessage: $"{nameof(Post)} failed. Request path: {requestPath}");
}

return null;
Expand Down

0 comments on commit 07b566d

Please sign in to comment.