Add test for ContextClosure.
[catagits/Catalyst-Runtime.git] / lib / Catalyst.pm
index 86865b2..435eee6 100644 (file)
@@ -1511,11 +1511,11 @@ sub execute {
     my $last = pop( @{ $c->stack } );
 
     if ( my $error = $@ ) {
-        if ( ref($error) and $error eq $DETACH ) {
-            die $DETACH if($c->depth > 1);
+        if ( blessed($error) and $error->isa('Catalyst::Exception::Detach') ) {
+            $error->rethrow if $c->depth > 1;
         }
-        elsif ( ref($error) and $error eq $GO ) {
-            die $GO if($c->depth > 0);
+        elsif ( blessed($error) and $error->isa('Catalyst::Exception::Go') ) {
+            $error->rethrow if $c->depth > 0;
         }
         else {
             unless ( ref $error ) {