Use methods to throw exceptions, instead of passing globals to die.
Florian Ragwitz [Fri, 26 Jun 2009 15:28:41 +0000 (15:28 +0000)]
lib/Catalyst.pm
lib/Catalyst/Dispatcher.pm

index a751984..435eee6 100644 (file)
@@ -1512,10 +1512,10 @@ sub execute {
 
     if ( my $error = $@ ) {
         if ( blessed($error) and $error->isa('Catalyst::Exception::Detach') ) {
-            die $DETACH if($c->depth > 1);
+            $error->rethrow if $c->depth > 1;
         }
         elsif ( blessed($error) and $error->isa('Catalyst::Exception::Go') ) {
-            die $GO if($c->depth > 0);
+            $error->rethrow if $c->depth > 0;
         }
         else {
             unless ( ref $error ) {
index be7787a..5a975ed 100644 (file)
@@ -225,7 +225,7 @@ Documented in L<Catalyst>
 sub go {
     my $self = shift;
     $self->_do_visit('go', @_);
-    die $Catalyst::GO;
+    Catalyst::Exception::Go->throw;
 }
 
 =head2 $self->forward( $c, $command [, \@arguments ] )
@@ -271,7 +271,7 @@ Documented in L<Catalyst>
 sub detach {
     my ( $self, $c, $command, @args ) = @_;
     $self->_do_forward(detach => $c, $command, @args ) if $command;
-    die $Catalyst::DETACH;
+    Catalyst::Exception::Detach->throw;
 }
 
 sub _action_rel2abs {