=begin pod :kind("Type") :subkind("class") :category("exception")

=TITLE class X::OutOfRange

=SUBTITLE Error due to indexing outside of an allowed range

    class X::OutOfRange is Exception { }

General error when something (for example an array index) is out of an allowed
range.

For example

    say 42[2];
    CATCH { default { put .^name, ': ', .Str } };
    # OUTPUT: «X::OutOfRange: Index out of range. Is: 2, should be in 0..0␤»

since scalars generally act as a one-element list.

=head1 Methods

=head2 method what

    method what(--> Str:D)

Verbal description of the thing that was out of range (e.g. C<"array index">,
C<"month">).

=head2 method got

    method got()

Returns the object that was considered out of range (often an integer)

=head2 method range

    method range(--> Range:D)

Returns a L<Range|/type/Range> object describing the permissible range for the object
returned from C<.got>.

=head2 method comment

    method comment(--> Str)

Returns an additional comment that is included in the error message.

=end pod
