From: Will Hawes Date: Thu, 26 Jan 2006 13:03:16 +0000 (+0000) Subject: more informative error in related_source when relationship doesn't exist X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=aea52c85cb46edd8f8fea4fe01f169fcba814c33;p=dbsrgits%2FDBIx-Class-Historic.git more informative error in related_source when relationship doesn't exist --- diff --git a/lib/DBIx/Class/ResultSource.pm b/lib/DBIx/Class/ResultSource.pm index 4a78664..789aeda 100644 --- a/lib/DBIx/Class/ResultSource.pm +++ b/lib/DBIx/Class/ResultSource.pm @@ -414,6 +414,9 @@ Returns the result source for the given relationship sub related_source { my ($self, $rel) = @_; + if( !$self->has_relationship( $rel ) ) { + croak "No such relationship '$rel'"; + } return $self->schema->source($self->relationship_info($rel)->{source}); }