Detect redispatch exceptions by a class check, not by checking the exception message.
[catagits/Catalyst-Runtime.git] / lib / Catalyst.pm
index 86865b2..a751984 100644 (file)
@@ -1511,10 +1511,10 @@ sub execute {
     my $last = pop( @{ $c->stack } );
 
     if ( my $error = $@ ) {
-        if ( ref($error) and $error eq $DETACH ) {
+        if ( blessed($error) and $error->isa('Catalyst::Exception::Detach') ) {
             die $DETACH if($c->depth > 1);
         }
-        elsif ( ref($error) and $error eq $GO ) {
+        elsif ( blessed($error) and $error->isa('Catalyst::Exception::Go') ) {
             die $GO if($c->depth > 0);
         }
         else {