summaryrefslogtreecommitdiff
path: root/Data-TagsAndRanges/lib/Data/TagsAndRanges/Exceptions.pm
diff options
context:
space:
mode:
Diffstat (limited to 'Data-TagsAndRanges/lib/Data/TagsAndRanges/Exceptions.pm')
-rw-r--r--Data-TagsAndRanges/lib/Data/TagsAndRanges/Exceptions.pm38
1 files changed, 38 insertions, 0 deletions
diff --git a/Data-TagsAndRanges/lib/Data/TagsAndRanges/Exceptions.pm b/Data-TagsAndRanges/lib/Data/TagsAndRanges/Exceptions.pm
new file mode 100644
index 0000000..c28824b
--- /dev/null
+++ b/Data-TagsAndRanges/lib/Data/TagsAndRanges/Exceptions.pm
@@ -0,0 +1,38 @@
+package Data::TagsAndRanges::Exceptions;
+package Data::TagsAndRanges::Exceptions::NotFound;{
+use Moose;
+extends 'Throwable::Error';
+
+has value => (
+ is => 'ro',
+ required => 1,
+);
+
+sub as_string {
+ my ($self) = @_;
+
+ my $str = $self->message . $self->value;
+ $str .= "\n\n" . $self->stack_trace->as_string;
+
+ return $str;
+}
+
+}
+package Data::TagsAndRanges::Exceptions::TagNotFound;{
+use Moose;
+extends 'Data::TagsAndRanges::Exceptions::NotFound';
+
+has '+message' => (
+ default => 'tag not found: ',
+);
+}
+package Data::TagsAndRanges::Exceptions::RangeNotFound;{
+use Moose;
+extends 'Data::TagsAndRanges::Exceptions::NotFound';
+
+has '+message' => (
+ default => 'no range found for value ',
+);
+}
+
+1;