From: Peter Rabbitson Date: Mon, 8 Apr 2013 09:21:27 +0000 (+0200) Subject: Escape more frames when determining carp/throw_exception originator X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=cc414f09f43faf9424895d7f6b470fbe2ef2b0ce;p=dbsrgits%2FDBIx-Class-Historic.git Escape more frames when determining carp/throw_exception originator Augments 5e0e5426b --- diff --git a/lib/DBIx/Class/Carp.pm b/lib/DBIx/Class/Carp.pm index 24ddd13..e0a1e92 100644 --- a/lib/DBIx/Class/Carp.pm +++ b/lib/DBIx/Class/Carp.pm @@ -42,7 +42,12 @@ sub __find_caller { and ! $Carp::Internal{$1} and - $2 !~ /^(?: throw_exception | carp | carp_unique | carp_once )$/x +############################# +# Need a way to parameterize this for Carp::Skip + $1 !~ /^(?: DBIx::Class::Storage::BlockRunner | Context::Preserve | Try::Tiny | Class::Accessor::Grouped | Class::C3::Componentised | Module::Runtime )$/x + and + $2 !~ /^(?: throw_exception | carp | carp_unique | carp_once | dbh_do | txn_do | with_deferred_fk_checks)$/x +############################# ) ? $f[3] : undef; if ( diff --git a/t/106dbic_carp.t b/t/106dbic_carp.t index 241fc5d..e6710d8 100644 --- a/t/106dbic_carp.t +++ b/t/106dbic_carp.t @@ -38,7 +38,9 @@ use DBICTest; sub thrower { sub { - DBICTest->init_schema(no_deploy => 1)->throw_exception('time to die'); + DBICTest->init_schema(no_deploy => 1)->storage->dbh_do(sub { + shift->throw_exception('time to die'); + }) }->(); }