[Jifty-commit] r4169 - in Jifty-DBI/trunk: lib/Jifty/DBI

jifty-commit at lists.jifty.org jifty-commit at lists.jifty.org
Mon Oct 1 23:57:14 EDT 2007


Author: jesse
Date: Mon Oct  1 23:57:13 2007
New Revision: 4169

Modified:
   Jifty-DBI/trunk/   (props changed)
   Jifty-DBI/trunk/lib/Jifty/DBI/Schema.pm

Log:
 r27290 at hualien:  jesse | 2007-10-01 23:55:46 -0400
 * When we fail to load a related model class for a good reason, actually die, rather than burying the error


Modified: Jifty-DBI/trunk/lib/Jifty/DBI/Schema.pm
==============================================================================
--- Jifty-DBI/trunk/lib/Jifty/DBI/Schema.pm	(original)
+++ Jifty-DBI/trunk/lib/Jifty/DBI/Schema.pm	Mon Oct  1 23:57:13 2007
@@ -338,8 +338,11 @@
         }
 
         # Load the class we reference
-        $refclass->require();
-
+        unless (UNIVERSAL::isa($refclass, 'Jifty::DBI::Record') || UNIVERSAL::isa($refclass, 'Jifty::DBI::Collection')) {
+            local $UNIVERSAL::require::ERROR;
+            $refclass->require();
+            die $UNIVERSAL::require::ERROR if ($UNIVERSAL::require::ERROR);
+        }
         # References assume a refernce to an integer ID unless told otherwise
         $column->type('integer') unless ( $column->type );
 
@@ -371,7 +374,7 @@
             $column->by('id') unless $column->by;
             $column->virtual('1');
         } else {
-            warn "Error in $from: $refclass neither Record nor Collection";
+            warn "Error in $from: $refclass neither Record nor Collection. Perhaps it couldn't be loaded?";
         }
     } elsif (my $handler = $column->attributes->{_init_handler}) {
         $handler->($column, $from);


More information about the Jifty-commit mailing list