fixed: Better error message.
[catagits/Catalyst-Runtime.git] / lib / Catalyst / Dispatcher.pm
index ab305ec..32ccd67 100644 (file)
@@ -135,9 +135,11 @@ sub forward {
 
     unless ( @{$results} ) {
         my $class = $command || '';
+        my $path  = $class . '.pm';
+        $path =~ s/::/\//g;
 
-        if ( $class =~ /[^\w\:]/ ) {
-            my $error = qq/"$class" is an invalid Class name/;
+        unless ( $INC{ $path } ) {
+            my $error = qq/Couldn't forward to "$class". Invalid or not loaded./;
             $c->error($error);
             $c->log->debug($error) if $c->debug;
             return 0;