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 RefreshFailedDueToFormattingError = "A refresh operation failed due to a formatting error.";

// 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 @@ -188,7 +188,7 @@ private FeatureFlag ParseFeatureFlag(string settingKey, string settingValue)
}
catch (JsonException e)
{
throw new FormatException(settingKey, e);
throw new FormatException(string.Format(ErrorMessages.FeatureFlagInvalidFormat, settingKey), e);
}

return featureFlag;
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.RefreshFailedDueToFormattingError}\n{exceptionMessage}";
}
}
}