summaryrefslogtreecommitdiff
path: root/lib/Data/MultiValued/Exceptions.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Data/MultiValued/Exceptions.pm')
-rw-r--r--lib/Data/MultiValued/Exceptions.pm58
1 files changed, 56 insertions, 2 deletions
diff --git a/lib/Data/MultiValued/Exceptions.pm b/lib/Data/MultiValued/Exceptions.pm
index 8d444c0..6495780 100644
--- a/lib/Data/MultiValued/Exceptions.pm
+++ b/lib/Data/MultiValued/Exceptions.pm
@@ -1,4 +1,21 @@
package Data::MultiValued::Exceptions;
+
+# ABSTRACT: exception classes
+
+=head1 DESCRIPTION
+
+This module defines a few exception classes, using L<Throwable::Error>
+as a base class.
+
+=head1 CLASSES
+
+=head2 C<Data::MultiValued::Exceptions::NotFound>
+
+Base class for "not found" errors. Has a C<value> attribute,
+containing the value that was not found.
+
+=cut
+
package Data::MultiValued::Exceptions::NotFound;{
use Moose;
extends 'Throwable::Error';
@@ -16,8 +33,19 @@ sub as_string {
return $str;
}
-
}
+
+=head2 C<Data::MultiValued::Exceptions::TagNotFound>
+
+Subclass of L</Data::MultiValued::Exceptions::NotFound>, for
+tags. Stringifies to:
+
+ tag not found: $value
+
+ $stack_trace
+
+=cut
+
package Data::MultiValued::Exceptions::TagNotFound;{
use Moose;
extends 'Data::MultiValued::Exceptions::NotFound';
@@ -26,14 +54,40 @@ has '+message' => (
default => 'tag not found: ',
);
}
+
+=head2 C<Data::MultiValued::Exceptions::RangeNotFound>
+
+Subclass of L</Data::MultiValued::Exceptions::NotFound>, for
+ranges. Stringifies to:
+
+ no range found for value: $value
+
+ $stack_trace
+
+=cut
+
package Data::MultiValued::Exceptions::RangeNotFound;{
use Moose;
extends 'Data::MultiValued::Exceptions::NotFound';
has '+message' => (
- default => 'no range found for value ',
+ default => 'no range found for value: ',
);
}
+
+=head2 C<Data::MultiValued::Exceptions::BadRange>
+
+Thrown when an invalid range is supplied to a method. An invalid range
+is a range with C<from> greater than C<to>.
+
+Stringifies to:
+
+ invalid range: $from, $to
+
+ $stack_trace
+
+=cut
+
package Data::MultiValued::Exceptions::BadRange;{
use Moose;
extends 'Throwable::Error';