From: Peter Rabbitson Date: Wed, 30 Mar 2016 13:44:15 +0000 (+0200) Subject: Fix *stupid* silencing of exceptions introduced in 4e9fc3f3 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=b4976ee31;p=dbsrgits%2FDBIx-Class.git Fix *stupid* silencing of exceptions introduced in 4e9fc3f3 The reason this has not been detected is because it is virtually impossible for the stock inflate_result() to throw, and pretty rare for custom ones. ARGH! Found and individually vetted all remaining eval()s as in: grep -Pnr -B2 -A7 '^(?!\s*#).*?\beval\b' lib | less --- diff --git a/Changes b/Changes index 9954895..07bb206 100644 --- a/Changes +++ b/Changes @@ -37,6 +37,7 @@ Revision history for DBIx::Class similar produces a large warning - Make sure exception objects stringifying to '' are properly handled and warned about (GH#15) + - Fix silencing of exceptions thrown by custom inflate_result() methods - Fix incorrect data returned in a corner case of partial-select HRI invocation (no known manifestations of this bug in the field, see commit message for description of exact failure scenario) diff --git a/lib/DBIx/Class/ResultSet.pm b/lib/DBIx/Class/ResultSet.pm index 0fc240c..71ff3ab 100644 --- a/lib/DBIx/Class/ResultSet.pm +++ b/lib/DBIx/Class/ResultSet.pm @@ -1413,7 +1413,7 @@ sub _construct_results { : '@$rows = map { $inflator_cref->($res_class, $rsrc, { %s } ) } @$rows' ), ( join (', ', map { "\$infmap->[$_] => \$_->[$_]" } 0..$#$infmap ) ) - ); + ) . '; 1' or die; } } else { diff --git a/t/resultset/inflate_result_api.t b/t/resultset/inflate_result_api.t index e09bad1..d4a0f8e 100644 --- a/t/resultset/inflate_result_api.t +++ b/t/resultset/inflate_result_api.t @@ -6,6 +6,7 @@ no warnings 'exiting'; use Test::More; use Test::Deep; +use Test::Exception; use DBICTest; @@ -548,6 +549,7 @@ sub cmp_structures { cmp_deeply($left, $right, $msg||()) or next INFTYPE; } + { package DBICTest::_DoubleResult; @@ -575,4 +577,18 @@ is_deeply( })->all_hri}) x 2 ], ); + +{ + package DBICTest::_DieTrying; + + sub inflate_result { + die "nyah nyah nyah"; + } +} + +throws_ok { + $schema->resultset('CD')->search({}, { result_class => 'DBICTest::_DieTrying' })->all +} qr/nyah nyah nyah/, 'Exception in custom inflate_result propagated correctly'; + + done_testing;