namespace PkmnLib.Static.Utils.Errors; /// /// A result that indicates an index is out of range. /// public class OutOfRangeException : Exception { private readonly string _hint; private readonly int _index; private readonly int _max; /// public OutOfRangeException(string hint, int index, int max) { _hint = hint; _index = index; _max = max; } /// public override string Message => _max == 0 ? $"{_hint} index {_index} is out of range. Collection is empty." : $"{_hint} index {_index} is out of range. Must be between 0 and {_max - 1}."; }