but also we should still throw a Catalyst::Exception if the CGI threw a simple scalar
Robert Buels [Thu, 5 Aug 2010 05:56:53 +0000 (22:56 -0700)]
lib/Catalyst/Controller/WrapCGI.pm

index a2897a5..88ed2af 100644 (file)
@@ -6,6 +6,7 @@ use mro 'c3';
 
 extends 'Catalyst::Controller';
 
+use Catalyst::Exception ();
 use HTTP::Request::AsCGI ();
 use HTTP::Request ();
 use URI ();
@@ -233,7 +234,12 @@ sub wrap_cgi {
 
     select($old);
 
-    die $saved_error if $saved_error;
+    if( $saved_error ) {
+        die $saved_error if ref $saved_error;
+        Catalyst::Exception->throw(
+            message => "CGI invocation failed: $saved_error"
+           );
+    }
   }
 
   return $env->response;