Skip to content

Commit

Permalink
improve logging when a request times out
Browse files Browse the repository at this point in the history
  • Loading branch information
Yvand committed Nov 14, 2023
1 parent c67e83d commit 0f9a219
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
using System.Linq;
using System.Net;
using System.Reflection;
using System.Threading;
using System.Threading.Tasks;
using Yvand.EntraClaimsProvider.Configuration;

Expand Down Expand Up @@ -103,6 +104,10 @@ public async override Task<List<string>> GetEntityGroupsAsync(OperationContext c
}
}
}
catch (TaskCanceledException ex)
{
Logger.LogException(ClaimsProviderName, $"while getting groups for user '{currentContext.IncomingEntity.Value}' from tenant '{tenant.Name}': The task likely exceeded the timeout of {currentContext.Settings.Timeout} ms and was canceled", TraceCategory.Augmentation, ex);
}
catch (Exception ex)
{
Logger.LogException(ClaimsProviderName, $"while getting groups for user '{currentContext.IncomingEntity.Value}' from tenant '{tenant.Name}'", TraceCategory.Augmentation, ex);
Expand Down Expand Up @@ -550,7 +555,7 @@ protected virtual async Task<List<DirectoryObject>> QueryEntraIDTenantAsync(Oper
}
catch (OperationCanceledException)
{
Logger.Log($"[{ClaimsProviderName}] Queries on Microsoft Entra ID tenant '{tenant.Name}' exceeded timeout of {timeout} ms and were cancelled.", TraceSeverity.Unexpected, EventSeverity.Error, TraceCategory.Lookup);
Logger.Log($"[{ClaimsProviderName}] Operation on Entra ID for tenant '{tenant.Name}' exceeded the timeout of {timeout} ms and was cancelled.", TraceSeverity.Unexpected, EventSeverity.Error, TraceCategory.Lookup);
}
catch (AuthenticationFailedException ex)
{
Expand Down

0 comments on commit 0f9a219

Please sign in to comment.