more informative error in related_source when relationship doesn't exist
Will Hawes [Thu, 26 Jan 2006 13:03:16 +0000 (13:03 +0000)]
lib/DBIx/Class/ResultSource.pm

index 4a78664..789aeda 100644 (file)
@@ -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});
 }