Skip to content

Commit

Permalink
Remove no longer needed try{} block in related rel instantiation
Browse files Browse the repository at this point in the history
This try{} is no longer necessary after 3b4c4d7, 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 3b4c4d7 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{} )
  • Loading branch information
ribasushi committed Aug 12, 2015
1 parent e187eec commit b47fb9c
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions lib/DBIx/Class/Relationship/Base.pm
Expand Up @@ -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') {
Expand Down

0 comments on commit b47fb9c

Please sign in to comment.