Skip to content

Commit

Permalink
Change the thrown exceptions to ArgumentOutOfRangeException
Browse files Browse the repository at this point in the history
  • Loading branch information
Dawid Pągowski committed Aug 22, 2023
1 parent a55ceba commit 8087b8d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions S7.Net/Helper/DateTimeExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ public static ushort GetDaysSinceIecDateStart(this DateTime dateTime)
{
if (dateTime < Date.IecMinDate)
{
throw new ArgumentException($"DateTime must be at least {Date.IecMinDate:d}");
throw new ArgumentOutOfRangeException($"DateTime must be at least {Date.IecMinDate:d}");
}
if (dateTime > Date.IecMaxDate)
{
throw new ArgumentException($"DateTime must be lower than {Date.IecMaxDate:d}");
throw new ArgumentOutOfRangeException($"DateTime must be lower than {Date.IecMaxDate:d}");
}

return (ushort)(dateTime - Date.IecMinDate).TotalDays;
Expand Down

0 comments on commit 8087b8d

Please sign in to comment.