From: John Napiorkowski Date: Wed, 8 Jun 2016 15:32:19 +0000 (-0500) Subject: fixed reported c->state regression X-Git-Tag: 5.90105~2 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=commitdiff_plain;h=cc7af07896de5c87baac6769907537038683ebe7 fixed reported c->state regression --- diff --git a/Changes b/Changes index 3ea3fae..95255b3 100644 --- a/Changes +++ b/Changes @@ -5,6 +5,10 @@ - Changed how we compose traits onto the response, request, and stats class so that we compose just once at setup time (performance optimization). Also added a debug screen at startup to display composed classes to help with debugging. + - Fixed a regressed caused by the changes we made to the way ->state works so that + now when you forward to an action and that action throws and exception, $c->state + is set to 0, instead of the value of the exeption (this is to be as indicated by + the documentation). 5.90104 - 2016-04-04 - Merged pull request #131, fix for noisy debug logs when used type constraints diff --git a/lib/Catalyst/Dispatcher.pm b/lib/Catalyst/Dispatcher.pm index 46f41f8..d64b17e 100644 --- a/lib/Catalyst/Dispatcher.pm +++ b/lib/Catalyst/Dispatcher.pm @@ -239,7 +239,7 @@ Documented in L sub forward { my $self = shift; no warnings 'recursion'; - $self->_do_forward(forward => @_); + return $self->_do_forward(forward => @_); } sub _do_forward { @@ -261,6 +261,12 @@ sub _do_forward { no warnings 'recursion'; $action->dispatch( $c ); + #If there is an error, all bets off regarding state. Documentation + #Specifies that when you forward, if there's an error you must expect + #state to be 0. + if( @{ $c->error }) { + $c->state(0); + } return $c->state; }