Skip to content

Commit

Permalink
Apply review suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
Hinton committed Sep 28, 2023
1 parent f96f690 commit 3847534
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/Core/Constants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,18 @@ public class RangeConstant
public int Min { get; }
public int Max { get; }

public RangeConstant(int min, int max, int def)
public RangeConstant(int min, int max, int defaultValue)
{
Default = def;
Default = defaultValue;
Min = min;
Max = max;

if (!InsideRange(def))
if (Min > Max)
{
throw new ArgumentOutOfRangeException($"{Min} is larger than {Max}.");
}

if (!InsideRange(defaultValue))
{
throw new ArgumentOutOfRangeException($"{Default} is outside allowed range of {Min}-{Max}.");
}
Expand Down

0 comments on commit 3847534

Please sign in to comment.