finalize_errors is in Context now (t/aggregate/live_component_controller_action_go...
[catagits/Catalyst-Runtime.git] / t / lib / TestApp / Context.pm
index 5121fc8..f621996 100644 (file)
@@ -1,8 +1,9 @@
 package TestApp::Context;
 use Moose;
 extends 'Catalyst::Context'; 
-with 'Catalyst::TraitFor::Context::TestHeaders';
-with 'Catalyst::TraitFor::Context::TestErrors';
+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';
@@ -53,5 +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;