summaryrefslogtreecommitdiff
path: root/Data-MultiValued/lib/Data/MultiValued/Exceptions.pm
diff options
context:
space:
mode:
authorGianni Ceccarelli <dakkar@thenautilus.net>2011-11-09 16:26:40 +0000
committerGianni Ceccarelli <dakkar@thenautilus.net>2011-11-09 16:26:40 +0000
commita3ac2afbd2800df8eda1295ebb5cf4fb83df2c2b (patch)
tree8992cadbec9a3c777eaf69145ae4243e45cf9f20 /Data-MultiValued/lib/Data/MultiValued/Exceptions.pm
parentprepare for renaming/split (diff)
downloaddata-multivalued-a3ac2afbd2800df8eda1295ebb5cf4fb83df2c2b.tar.gz
data-multivalued-a3ac2afbd2800df8eda1295ebb5cf4fb83df2c2b.tar.bz2
data-multivalued-a3ac2afbd2800df8eda1295ebb5cf4fb83df2c2b.zip
renaming
Diffstat (limited to 'Data-MultiValued/lib/Data/MultiValued/Exceptions.pm')
-rw-r--r--Data-MultiValued/lib/Data/MultiValued/Exceptions.pm57
1 files changed, 57 insertions, 0 deletions
diff --git a/Data-MultiValued/lib/Data/MultiValued/Exceptions.pm b/Data-MultiValued/lib/Data/MultiValued/Exceptions.pm
new file mode 100644
index 0000000..571db0a
--- /dev/null
+++ b/Data-MultiValued/lib/Data/MultiValued/Exceptions.pm
@@ -0,0 +1,57 @@
+package Data::MultiValued::Exceptions;
+package Data::MultiValued::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::MultiValued::Exceptions::TagNotFound;{
+use Moose;
+extends 'Data::MultiValued::Exceptions::NotFound';
+
+has '+message' => (
+ default => 'tag not found: ',
+);
+}
+package Data::MultiValued::Exceptions::RangeNotFound;{
+use Moose;
+extends 'Data::MultiValued::Exceptions::NotFound';
+
+has '+message' => (
+ default => 'no range found for value ',
+);
+}
+package Data::MultiValued::Exceptions::BadRange;{
+use Moose;
+extends 'Throwable::Error';
+
+has ['from','to'] => ( is => 'ro', required => 1 );
+has '+message' => (
+ default => 'invalid range: ',
+);
+
+sub as_string {
+ my ($self) = @_;
+
+ my $str = $self->message . $self->from . ', ' . $self->to;
+ $str .= "\n\n" . $self->stack_trace->as_string;
+
+ return $str;
+}
+
+}
+
+1;