From: Dagfinn Ilmari Mannsåker Date: Mon, 16 Jan 2017 12:06:31 +0000 (+0000) Subject: Include the source name in all "No such relationship" errors X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=d3482bd30ed75b36577287b176282b769dd987ac;p=dbsrgits%2FDBIx-Class.git Include the source name in all "No such relationship" errors 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 --- diff --git a/lib/DBIx/Class/Relationship/Base.pm b/lib/DBIx/Class/Relationship/Base.pm index b7e74eb..707c098 100644 --- a/lib/DBIx/Class/Relationship/Base.pm +++ b/lib/DBIx/Class/Relationship/Base.pm @@ -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'; diff --git a/lib/DBIx/Class/ResultSource.pm b/lib/DBIx/Class/ResultSource.pm index ddef544..4822254 100644 --- a/lib/DBIx/Class/ResultSource.pm +++ b/lib/DBIx/Class/ResultSource.pm @@ -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,