From: Sebastian Riedel Date: Mon, 4 Apr 2005 20:40:42 +0000 (+0000) Subject: fixed what i've borked X-Git-Tag: 5.7099_04~1595 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=commitdiff_plain;h=b9ffe28babb15048f8315c972266b9462fdfc238 fixed what i've borked --- diff --git a/lib/Catalyst/Engine.pm b/lib/Catalyst/Engine.pm index d09d2d9..510ca4d 100644 --- a/lib/Catalyst/Engine.pm +++ b/lib/Catalyst/Engine.pm @@ -121,11 +121,13 @@ sub dispatch { $c->state(1); if ( my $begin = @{ $c->get_action( 'begin', $namespace ) }[-1] ) { $c->execute( @{ $begin->[0] } ); + return if scalar @{ $c->error }; } # Execute the auto chain for my $auto ( @{ $c->get_action( 'auto', $namespace ) } ) { $c->execute( @{ $auto->[0] } ); + return if scalar @{ $c->error }; last unless $c->state; } @@ -139,6 +141,7 @@ sub dispatch { # Execute last end if ( my $end = @{ $c->get_action( 'end', $namespace ) }[-1] ) { $c->execute( @{ $end->[0] } ); + return if scalar @{ $c->error }; } } else { @@ -200,10 +203,14 @@ sub execute { else { $c->state( &$code( $class, $c, @{ $c->req->args } ) ) } }; if ( my $error = $@ ) { - chomp $error; - $error = qq/Caught exception "$error"/; + + unless ( ref $error ) { + chomp $error; + $error = qq/Caught exception "$error"/; + } + $c->log->error($error); - $c->error($error) if $c->debug; + $c->error($error); $c->state(0); } return $c->state; @@ -433,6 +440,8 @@ sub forward { } for my $result ( @{$results} ) { $c->execute( @{ $result->[0] } ); + return if scalar @{ $c->error }; + last unless $c->state; } return $c->state; }