Include the source name in all "No such relationship" errors topic/rt119863-related-resultset-error-message
Dagfinn Ilmari Mannsåker [Mon, 16 Jan 2017 12:06:31 +0000 (12:06 +0000)]
It was not included when calling related_resultset on a result object.
In passing, quote the relationship name in one place it wasn't, for
consistency. RT#119863

lib/DBIx/Class/Relationship/Base.pm
lib/DBIx/Class/ResultSource.pm

index b7e74eb..707c098 100644 (file)
@@ -527,7 +527,7 @@ sub related_resultset {
   my $rsrc = $self->result_source;
 
   my $rel_info = $rsrc->relationship_info($rel)
-    or $self->throw_exception( "No such relationship '$rel'" );
+    or $self->throw_exception( "No such relationship '$rel' on " . $rsrc->source_name );
 
   my $relcond_is_freeform = ref $rel_info->{cond} eq 'CODE';
 
index ddef544..4822254 100644 (file)
@@ -2076,7 +2076,7 @@ sub _resolve_join {
     );
 
     my $rel_info = $self->relationship_info($join)
-      or $self->throw_exception("No such relationship $join on " . $self->source_name);
+      or $self->throw_exception("No such relationship '$join' on " . $self->source_name);
 
     my $rel_src = $self->related_source($join);
     return [ { $as => $rel_src->from,