From 2a6ca02bd5b99cb00b22d4e974ff3a43aa7426d4 Mon Sep 17 00:00:00 2001 From: waldekmastykarz Date: Mon, 13 May 2024 16:18:41 +0200 Subject: [PATCH] Expands APIC plugins exception handling --- dev-proxy-plugins/RequestLogs/ApiCenterOnboardingPlugin.cs | 6 +----- .../RequestLogs/ApiCenterProductionVersionPlugin.cs | 6 +----- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/dev-proxy-plugins/RequestLogs/ApiCenterOnboardingPlugin.cs b/dev-proxy-plugins/RequestLogs/ApiCenterOnboardingPlugin.cs index f4a1c1ab..1be3d7af 100644 --- a/dev-proxy-plugins/RequestLogs/ApiCenterOnboardingPlugin.cs +++ b/dev-proxy-plugins/RequestLogs/ApiCenterOnboardingPlugin.cs @@ -142,11 +142,7 @@ public override void Register(IPluginEvents pluginEvents, { _ = authenticationHandler.GetAccessToken(CancellationToken.None).Result; } - catch (Exception ex) when - // dev credential - (ex is AuthenticationFailedException || - // prod credential - ex is AggregateException && ex.InnerException is CredentialUnavailableException) + catch (Exception ex) { _logger?.LogError(ex, "Failed to authenticate with Azure. The {plugin} will not be used.", Name); return; diff --git a/dev-proxy-plugins/RequestLogs/ApiCenterProductionVersionPlugin.cs b/dev-proxy-plugins/RequestLogs/ApiCenterProductionVersionPlugin.cs index 9cd0a08b..5ce38094 100644 --- a/dev-proxy-plugins/RequestLogs/ApiCenterProductionVersionPlugin.cs +++ b/dev-proxy-plugins/RequestLogs/ApiCenterProductionVersionPlugin.cs @@ -153,11 +153,7 @@ public override void Register(IPluginEvents pluginEvents, { _ = authenticationHandler.GetAccessToken(CancellationToken.None).Result; } - catch (Exception ex) when - // dev credential - (ex is AuthenticationFailedException || - // prod credential - ex is AggregateException && ex.InnerException is CredentialUnavailableException) + catch (Exception ex) { _logger?.LogError(ex, "Failed to authenticate with Azure. The {plugin} will not be used.", Name); return;