From b47fb9c0c3fee01f3641da23d34b8428ab1e9a70 Mon Sep 17 00:00:00 2001 From: Peter Rabbitson Date: Wed, 24 Jun 2015 13:04:28 +0200 Subject: [PATCH] Remove no longer needed try{} block in related rel instantiation This try{} is no longer necessary after 3b4c4d72, but was missed due to its purpose not being readily apparent. The only known case where this exception could be raised and be silenced is if an uninserted object had some filter relations populated directly via {_inflated_column} *before* related_resultset() has ever been called. This would result in a cascade of failures during the relationship resolution, and bubble up here. Starting with 3b4c4d72 the empty related resultset is instantiated ahead of time, and everything works properly from there on. In the unlikely case this does cause issues downstream, a way will be found to address this ( worst case scenario by reintroducing the try{} ) --- lib/DBIx/Class/Relationship/Base.pm | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/lib/DBIx/Class/Relationship/Base.pm b/lib/DBIx/Class/Relationship/Base.pm index 158740390..c7daf5708 100644 --- a/lib/DBIx/Class/Relationship/Base.pm +++ b/lib/DBIx/Class/Relationship/Base.pm @@ -523,15 +523,7 @@ sub related_resultset { if (@_ > 1 && (@_ % 2 == 1)); my $query = ((@_ > 1) ? {@_} : shift); - # condition resolution may fail if an incomplete master-object prefetch - # is encountered - that is ok during prefetch construction (not yet in_storage) - my ($cond, $is_crosstable) = try { - $rsrc->_resolve_condition( $rel_info->{cond}, $rel, $self, $rel ) - } - catch { - $self->throw_exception ($_) if $self->in_storage; - UNRESOLVABLE_CONDITION; # RV, no return() - }; + my ($cond, $is_crosstable) = $rsrc->_resolve_condition( $rel_info->{cond}, $rel, $self, $rel ); # keep in mind that the following if() block is part of a do{} - no return()s!!! if ($is_crosstable and ref $rel_info->{cond} eq 'CODE') {