X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FRow.pm;h=bdc7aee8b0d36a6857f171550c55128d005cc6e1;hb=4df1400e9a42e3e19f143151de2c8ba5865cb553;hp=d88edc2e02f7fcc79c4349a4d78ec37f08cf7ed1;hpb=ce556881780369e33743ef86a0cb183e976d3d19;p=dbsrgits%2FDBIx-Class.git diff --git a/lib/DBIx/Class/Row.pm b/lib/DBIx/Class/Row.pm index d88edc2..bdc7aee 100644 --- a/lib/DBIx/Class/Row.pm +++ b/lib/DBIx/Class/Row.pm @@ -1186,8 +1186,27 @@ sub inflate_result { for my $pre ( keys %$prefetch ) { my @pre_objects; - if (@{$prefetch->{$pre}||[]}) { - my $pre_source = $source->related_source($pre); + if ( + @{$prefetch->{$pre}||[]} + and + ref($prefetch->{$pre}) ne $DBIx::Class::ResultSource::RowParser::Util::null_branch_class + ) { + my $pre_source = try { + $source->related_source($pre) + } catch { + my $err = sprintf + "Inflation into non-existent relationship '%s' of '%s' requested", + $pre, + $source->source_name, + ; + if (my ($colname) = sort { length($a) <=> length ($b) } keys %{$prefetch->{$pre}[0] || {}} ) { + $err .= sprintf ", check the inflation specification (columns/as) ending in '...%s.%s'", + $pre, + $colname, + } + + $source->throw_exception($err); + }; @pre_objects = map { $pre_source->result_class->inflate_result( $pre_source, @$_ )