diff options
Diffstat (limited to 'lib/Data/MultiValued/Exceptions.pm')
-rw-r--r-- | lib/Data/MultiValued/Exceptions.pm | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/lib/Data/MultiValued/Exceptions.pm b/lib/Data/MultiValued/Exceptions.pm index 6495780..84d6ffa 100644 --- a/lib/Data/MultiValued/Exceptions.pm +++ b/lib/Data/MultiValued/Exceptions.pm @@ -18,7 +18,15 @@ containing the value that was not found. package Data::MultiValued::Exceptions::NotFound;{ use Moose; -extends 'Throwable::Error'; +with 'Throwable'; +use overload + q{""} => 'as_string', + fallback => 1; + +has message => ( + is => 'ro', + required => 1, +); has value => ( is => 'ro', @@ -29,7 +37,6 @@ sub as_string { my ($self) = @_; my $str = $self->message . ($self->value // '<undef>'); - $str .= "\n\n" . $self->stack_trace->as_string; return $str; } @@ -42,8 +49,6 @@ tags. Stringifies to: tag not found: $value - $stack_trace - =cut package Data::MultiValued::Exceptions::TagNotFound;{ @@ -62,8 +67,6 @@ ranges. Stringifies to: no range found for value: $value - $stack_trace - =cut package Data::MultiValued::Exceptions::RangeNotFound;{ @@ -84,24 +87,21 @@ Stringifies to: invalid range: $from, $to - $stack_trace - =cut package Data::MultiValued::Exceptions::BadRange;{ use Moose; -extends 'Throwable::Error'; +with 'Throwable'; +use overload + q{""} => 'as_string', + fallback => 1; 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; + my $str = 'invalid range: ' . $self->from . ', ' . $self->to; return $str; } |