release 0.031
[catagits/Catalyst-Controller-WrapCGI.git] / lib / Catalyst / Controller / WrapCGI.pm
index 5ddf71f..5ad38e0 100644 (file)
@@ -6,10 +6,10 @@ use mro 'c3';
 
 extends 'Catalyst::Controller';
 
+use Catalyst::Exception ();
 use HTTP::Request::AsCGI ();
 use HTTP::Request ();
 use URI ();
-use Catalyst::Exception ();
 use URI::Escape;
 use HTTP::Request::Common;
 
@@ -21,7 +21,7 @@ Catalyst::Controller::WrapCGI - Run CGIs in Catalyst
 
 =cut
 
-our $VERSION = '0.028';
+our $VERSION = '0.031';
 
 =head1 SYNOPSIS
 
@@ -234,9 +234,12 @@ sub wrap_cgi {
 
     select($old);
 
-    Catalyst::Exception->throw(
-        message => "CGI invocation failed: $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;