X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FException.pm;h=2bdfc8db5a07d65d4c3b876fb02a6b0afa98c857;hb=4cf392a17cae90f02305e0d122953b3927780d1c;hp=85c08b29b0e2e74cd0ae0cdf532cba82954b3cc3;hpb=289500c2badc4265f59dc571fe31474145ccbe82;p=dbsrgits%2FDBIx-Class.git diff --git a/lib/DBIx/Class/Exception.pm b/lib/DBIx/Class/Exception.pm index 85c08b2..2bdfc8d 100644 --- a/lib/DBIx/Class/Exception.pm +++ b/lib/DBIx/Class/Exception.pm @@ -5,6 +5,7 @@ use warnings; use Carp::Clan qw/^DBIx::Class/; use Scalar::Util qw/blessed/; +use Try::Tiny; use overload '""' => sub { shift->{msg} }, @@ -42,7 +43,7 @@ C<$stacktrace> tells it to use L instead of L. DBIx::Class::Exception->throw('Foo'); - eval { ... }; DBIx::Class::Exception->throw($@) if $@; + try { ... } catch { DBIx::Class::Exception->throw(shift) } =cut @@ -54,14 +55,12 @@ sub throw { # use Carp::Clan's croak if we're not stack tracing if(!$stacktrace) { - local $@; - eval { croak $msg }; - $msg = $@ + try { croak $msg } catch { $msg = shift }; } else { $msg = Carp::longmess($msg); } - + my $self = { msg => $msg }; bless $self => $class;