X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FStorage.pm;h=47aef3699b7d636ed6e01f8b25570ad086c7bdea;hb=ddcc02d1;hp=fc87ceb05c2dfa7d6ec2d61e6a1b6056b398b3b0;hpb=db83437ef48f4571e1d225572cc7235eb5e64fe3;p=dbsrgits%2FDBIx-Class.git diff --git a/lib/DBIx/Class/Storage.pm b/lib/DBIx/Class/Storage.pm index fc87ceb..47aef36 100644 --- a/lib/DBIx/Class/Storage.pm +++ b/lib/DBIx/Class/Storage.pm @@ -16,6 +16,7 @@ use DBIx::Class::Carp; use DBIx::Class::Storage::BlockRunner; use Scalar::Util qw/blessed weaken/; use DBIx::Class::Storage::TxnScopeGuard; +use DBIx::Class::_Util 'dbic_internal_try'; use Try::Tiny; use namespace::clean; @@ -253,12 +254,12 @@ sub txn_rollback { $self->{transaction_depth}--; # in case things get really hairy - just disconnect - eval { $self->_exec_txn_rollback; 1 } or do { + dbic_internal_try { $self->_exec_txn_rollback; 1 } or do { my $rollback_error = $@; # whatever happens, too low down the stack to care # FIXME - revisit if stackable exceptions become a thing - eval { $self->disconnect }; + dbic_internal_try { $self->disconnect }; die $rollback_error; }; @@ -310,16 +311,19 @@ sub __delicate_rollback { return; } + my @args = @_; my $rbe; - local $@; # taking no chances - unless( eval { $self->txn_rollback; 1 } ) { + dbic_internal_try { + $self->txn_rollback; 1 + } + catch { - $rbe = $@; + $rbe = $_; # we were passed an existing exception to augment (think DESTROY stacks etc) - if (@_) { - my $exception = shift; + if (@args) { + my ($exception) = @args; # append our text - THIS IS A TEMPORARY FIXUP! # @@ -367,7 +371,7 @@ sub __delicate_rollback { ) =~ s/Transaction aborted: (?=Transaction aborted:)//; } } - } + }; return $rbe; } @@ -577,7 +581,7 @@ sub debugobj { $self->throw_exception("Unable to parse TRACE_PROFILE config file '$profile' without $missing"); } - my $cfg = try { + my $cfg = dbic_internal_try { Config::Any->load_files({ files => [$profile], use_ext => 1 }); } catch { # sanitize the error message a bit @@ -603,7 +607,7 @@ sub debugobj { # # Yes I am aware this is fragile and TxnScopeGuard needs # a better fix. This is another yak to shave... :( - try { + dbic_internal_try { DBIx::Class::Storage::Debug::PrettyPrint->new(@pp_args); } catch { $self->throw_exception($_);