{
my @expected = qw[
TestApp::Controller::Action::Chained->begin
+ TestApp::Controller::Action::Chained->chain_error_a
+ TestApp::Controller::Action::Chained->end
+ ];
+
+ my $expected = join( ", ", @expected );
+
+ ok( my $response = request('http://localhost/chained/chain_error/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' );
+ }
+
+ #
+ # Test dieing in the middle of a chain.
+ #
+ {
+ my @expected = qw[
+ TestApp::Controller::Action::Chained->begin
TestApp::Controller::Action::Chained->chain_die_a
TestApp::Controller::Action::Chained->end
];
"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' );
+ is( $response->content, 'FATAL ERROR: Caught exception in TestApp::Controller::Action::Chained->chain_die_a "die in the middle of a chain"', 'Content OK' );
}
#
sub chain_dt_b :Chained('chain_dt_a') :PathPart('end') :Args(1) { }
#
+# Error in the middle of a chain
+#
+sub chain_error_a :Chained :PathPart('chained/chain_error') :CaptureArgs(1) {
+ $_[1]->error( 'break in the middle of a chain' );
+}
+
+sub chain_error_b :Chained('chain_error_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' );
+ die( "die in the middle of a chain\n" );
}
sub chain_die_b :Chained('chain_die_a') :PathPart('end') :Args(1) {}