Merged patched from andyg to throw useful errors during relationship loading
[dbsrgits/DBIx-Class.git] / lib / DBIx / Class / Relationship / BelongsTo.pm
index aca69aa..7435d7b 100644 (file)
@@ -6,6 +6,10 @@ use warnings;
 sub belongs_to {
   my ($class, $rel, $f_class, $cond, $attrs) = @_;
   eval "require $f_class";
+  if ($@) {
+    $class->throw($@) unless $@ =~ /Can't locate/;
+  }
+
   my %f_primaries;
   $f_primaries{$_} = 1 for eval { $f_class->primary_columns };
   my $f_loaded = !$@;