X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FRelationship%2FBase.pm;h=e53311768c589d18ca5c78913b4e633b42dbcf44;hb=ed7ab0f4ce1a9118ea6285ee562ef003085a6b64;hp=35ae568eb183efe8289ff8fd5f0d92240695fe6b;hpb=7803e57ad8daee28020676140ea6894c31e3112e;p=dbsrgits%2FDBIx-Class.git diff --git a/lib/DBIx/Class/Relationship/Base.pm b/lib/DBIx/Class/Relationship/Base.pm index 35ae568..e533117 100644 --- a/lib/DBIx/Class/Relationship/Base.pm +++ b/lib/DBIx/Class/Relationship/Base.pm @@ -5,6 +5,7 @@ use warnings; use Scalar::Util (); use base qw/DBIx::Class/; +use Try::Tiny; =head1 NAME @@ -237,15 +238,16 @@ sub related_resultset { # condition resolution may fail if an incomplete master-object prefetch # is encountered - that is ok during prefetch construction (not yet in_storage) - my $cond = eval { $source->_resolve_condition( $rel_info->{cond}, $rel, $self ) }; - if (my $err = $@) { + my $cond; + try { $cond = $source->_resolve_condition( $rel_info->{cond}, $rel, $self ) } + catch { if ($self->in_storage) { - $self->throw_exception ($err); + $self->throw_exception ($_); } else { $cond = $DBIx::Class::ResultSource::UNRESOLVABLE_CONDITION; } - } + }; if ($cond eq $DBIx::Class::ResultSource::UNRESOLVABLE_CONDITION) { my $reverse = $source->reverse_relationship_info($rel);