diff options
-rw-r--r-- | lib/Data/MultiValued/AttributeTrait.pm | 2 | ||||
-rw-r--r-- | lib/Data/MultiValued/Exceptions.pm | 28 |
2 files changed, 14 insertions, 16 deletions
diff --git a/lib/Data/MultiValued/AttributeTrait.pm b/lib/Data/MultiValued/AttributeTrait.pm index b2876b9..eb8cbd3 100644 --- a/lib/Data/MultiValued/AttributeTrait.pm +++ b/lib/Data/MultiValued/AttributeTrait.pm @@ -271,8 +271,6 @@ sub load_multi_value { unless (ref($_) && $_->isa('Data::MultiValued::Exceptions::NotFound')) { die $_; } - # XXX FIXME horrible hack to prevent StackTrace::Auto from leaking - delete $_->{stack_trace}; $found = 0; }; 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; } |