ErrorMessageFormatter
Defines static methods to format error messages.
using Relativity.DataExchange.Resources;
using System;
using System.Globalization;
namespace Relativity.DataExchange
{
internal static class ErrorMessageFormatter
{
public static string FormatWebServiceRetryMessage(string serviceOperation, string errorMessage, TimeSpan waitDuration, int retryAttempt, int maxRetries)
{
return AppendRetryDetails(string.Format(CultureInfo.CurrentCulture, Strings.WebServiceNotFatalRetryMessage, serviceOperation, errorMessage), waitDuration, maxRetries - retryAttempt);
}
public static string AppendRetryDetails(string message, TimeSpan waitDuration, int retriesLeft)
{
message = message.TrimEnd(' ', '.');
message += ". ";
message = ((retriesLeft <= 0) ? (message + Strings.RetryIssueNoAttemptsLeftAppendMessage) : (message + string.Format(CultureInfo.CurrentCulture, Strings.RetryIssueAppendMessage, waitDuration.TotalSeconds, retriesLeft)));
return message;
}
}
}