}
local $c->request->{arguments} = \@args;
$action->dispatch( $c );
+
+ # break the chain if exception occurs in the middle of chain
+ return if (@{$c->error} && $c->config->{detach_on_die});
}
$last->dispatch( $c );
}
}
#
+ #
+ #
+ {
+ my @expected = qw[
+ TestApp::Controller::Action::Chained->begin
+ TestApp::Controller::Action::Chained->chain_die_a
+ TestApp::Controller::Action::Chained->end
+ ];
+
+ my $expected = join( ", ", @expected );
+
+ ok( my $response = request('http://localhost/chained/chain_die/1/end/2'),
+ "Break a chain in the middle" );
+ is( $response->header('X-Catalyst-Executed'),
+ $expected, 'Executed actions' );
+ is( $response->content, 'FATAL ERROR: break in the middle of a chain', 'Content OK' );
+ }
+
+ #
# Tests that an uri_for to a chained root index action
# returns the right value.
#
sub chain_dt_b :Chained('chain_dt_a') :PathPart('end') :Args(1) { }
#
+# Die in the middle of a chain
+#
+sub chain_die_a :Chained :PathPart('chained/chain_die') :CaptureArgs(1) {
+ $_[1]->error( 'break in the middle of a chain' );
+}
+
+sub chain_die_b :Chained('chain_die_a') :PathPart('end') :Args(1) {}
+
+#
# Target for former forward and chain tests.
#
sub fw_dt_target :Private { }