Skip to content
Original file line number Diff line number Diff line change
Expand Up @@ -492,6 +492,12 @@ public async Task<bool> TryRefreshAsync(CancellationToken cancellationToken)

return false;
}
catch (FormatException fe)
{
_logger.LogWarning(LogHelper.BuildRefreshFailedDueToFormattingErrorMessage(fe.Message));

return false;
}

return true;
}
Expand Down Expand Up @@ -634,6 +640,7 @@ exception is KeyVaultReferenceException ||
exception is TimeoutException ||
exception is OperationCanceledException ||
exception is InvalidOperationException ||
exception is FormatException ||
((exception as AggregateException)?.InnerExceptions?.Any(e =>
e is RequestFailedException ||
e is OperationCanceledException) ?? false)))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ internal class LoggingConstants
public const string RefreshFailedDueToKeyVaultError = "A refresh operation failed while resolving a Key Vault reference.";
public const string PushNotificationUnregisteredEndpoint = "Ignoring the push notification received for the unregistered endpoint";
public const string FallbackClientLookupError = "Failed to perform fallback client lookup.";
public const string RefreshFormattingError = "A refresh operation failed due to a formatting error.";
Comment thread
amerjusupovic marked this conversation as resolved.
Outdated

// Successful update, debug log level
public const string RefreshKeyValueRead = "Key-value read from App Configuration.";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public FeatureManagementKeyValueAdapter(FeatureFilterTracing featureFilterTracin

public Task<IEnumerable<KeyValuePair<string, string>>> ProcessKeyValue(ConfigurationSetting setting, Logger logger, CancellationToken cancellationToken)
{
FeatureFlag featureFlag = ParseFeatureFlag(setting.Key, setting.Value);
FeatureFlag featureFlag = ParseFeatureFlag($"Failed to parse invalid feature flag json. Key: '{setting.Key}'", setting.Value);
Comment thread
amerjusupovic marked this conversation as resolved.
Outdated

var keyValues = new List<KeyValuePair<string, string>>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,5 +89,10 @@ public static string BuildFallbackClientLookupFailMessage(string exceptionMessag
{
return $"{LoggingConstants.FallbackClientLookupError}\n{exceptionMessage}";
}

public static string BuildRefreshFailedDueToFormattingErrorMessage(string exceptionMessage)
{
return $"{LoggingConstants.RefreshFormattingError}\n{exceptionMessage}";
}
}
}