Private error is now debug
[catagits/Catalyst-Runtime.git] / lib / Catalyst / Dispatcher.pm
index eb92137..8cc0737 100644 (file)
@@ -121,7 +121,9 @@ sub forward {
     unless ( @{$results} ) {
         my $class = $command;
         if ( $class =~ /[^\w\:]/ ) {
-            $c->log->debug(qq/Couldn't forward to "$class"/) if $c->debug;
+            my $error = qq/Couldn't forward to "$class"/;
+            $c->error($error);
+            $c->log->debug($error) if $c->debug;
             return 0;
         }
         my $method = shift || 'process';
@@ -130,7 +132,9 @@ sub forward {
             $results = [ [ [ $class, $code ] ] ];
         }
         else {
-            $c->log->debug(qq/Couldn't forward to "$class->$method"/)
+            my $error = qq/Couldn't forward to "$class->$method"/;
+            $c->error($error);
+            $c->log->debug($error)
               if $c->debug;
             return 0;
         }
@@ -231,6 +235,13 @@ sub set_action {
         elsif ( $attr =~ /^(Regex|Regexp)\((.+)\)$/i ) { $flags{regex} = $2 }
     }
 
+    if ( $flags{private} && ( keys %flags > 1 ) ) {
+        $c->log->debug( 'Bad action definition "'
+              . join( ' ', @{$attrs} )
+              . qq/" for "$namespace->$method"/ )
+          if $c->debug;
+        return;
+    }
     return unless keys %flags;
 
     my $parent  = $c->tree;