<PackageReference Include="Polly" Version="6.1.0" />

TimeoutValidator

static class TimeoutValidator
using System; using System.Threading; namespace Polly.Timeout { internal static class TimeoutValidator { internal static readonly TimeSpan InfiniteTimeSpan = System.Threading.Timeout.InfiniteTimeSpan; internal static void ValidateSecondsTimeout(int seconds) { if (seconds <= 0) throw new ArgumentOutOfRangeException("seconds"); } internal static void ValidateTimeSpanTimeout(TimeSpan timeout) { if (timeout <= TimeSpan.Zero && timeout != InfiniteTimeSpan) throw new ArgumentOutOfRangeException("timeout", timeout, string.Format("{0} must be a positive TimeSpan (or Timeout.InfiniteTimeSpan to indicate no timeout)", "timeout")); } } }