finalize_errors is in Context now (t/aggregate/live_component_controller_action_go...
[catagits/Catalyst-Runtime.git] / t / lib / TestApp / Context.pm
index 1aa6d7e..f621996 100644 (file)
@@ -1,6 +1,9 @@
 package TestApp::Context;
 use Moose;
 extends 'Catalyst::Context'; 
+with 'Catalyst::TraitFor::Context::TestHeaders',
+     'Catalyst::TraitFor::Context::TestErrors',
+     'Catalyst::TraitFor::Context::TestPluginServer';
 
 if (eval { Class::MOP::load_class('CatalystX::LeakChecker'); 1 }) {
     with 'CatalystX::LeakChecker';
@@ -51,6 +54,16 @@ sub execute {
     return $c->SUPER::execute(@_);
 }
 
+# Replace the very large HTML error page with
+# useful info if something crashes during a test
+sub finalize_error {
+    my $c = shift;
+
+    $c->next::method(@_);
+
+    $c->res->status(500);
+    $c->res->body( 'FATAL ERROR: ' . join( ', ', @{ $c->error } ) );
+}
 
 1;