X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst.pm;h=3ec38fcd0307aaca4b6437f7553a12f60e082f26;hb=e25e23a7e56014e6c36e83e1b2d55106186ffe4d;hp=2c4c3544413b9189198ef5a5bef95b0811678437;hpb=5077b8a320ea9dd6ddfe183c40d5c4bb5fd7595a;p=catagits%2FCatalyst-Runtime.git diff --git a/lib/Catalyst.pm b/lib/Catalyst.pm old mode 100644 new mode 100755 index 2c4c354..3ec38fc --- a/lib/Catalyst.pm +++ b/lib/Catalyst.pm @@ -126,7 +126,7 @@ __PACKAGE__->stats_class('Catalyst::Stats'); # Remember to update this in Catalyst::Runtime as well! -our $VERSION = '5.90059_005'; +our $VERSION = '5.90062'; sub import { my ( $class, @arguments ) = @_; @@ -1133,15 +1133,6 @@ sub setup { $class->setup_log( delete $flags->{log} ); $class->setup_plugins( delete $flags->{plugins} ); - # Call plugins setup, this is stupid and evil. - # Also screws C3 badly on 5.10, hack to avoid. - { - no warnings qw/redefine/; - local *setup = sub { }; - $class->setup unless $Catalyst::__AM_RESTARTING; - } - - $class->setup_middleware(); $class->setup_data_handlers(); $class->setup_dispatcher( delete $flags->{dispatcher} ); if (my $engine = delete $flags->{engine}) { @@ -1174,6 +1165,16 @@ You are running an old script! EOF } + # Call plugins setup, this is stupid and evil. + # Also screws C3 badly on 5.10, hack to avoid. + { + no warnings qw/redefine/; + local *setup = sub { }; + $class->setup unless $Catalyst::__AM_RESTARTING; + } + + $class->setup_middleware(); + # Initialize our data structure $class->components( {} ); @@ -1737,6 +1738,10 @@ sub execute { my $last = pop( @{ $c->stack } ); if ( my $error = $@ ) { + #rethow if this can be handled by middleware + if(blessed $error && ($error->can('as_psgi') || $error->can('code'))) { + $error->can('rethrow') ? $error->rethrow : croak $error; + } if ( blessed($error) and $error->isa('Catalyst::Exception::Detach') ) { $error->rethrow if $c->depth > 1; } @@ -2014,12 +2019,12 @@ sub handle_request { $c->dispatch; $status = $c->finalize; } catch { - chomp(my $error = $_); - $class->log->error(qq/Caught exception in engine "$error"/); #rethow if this can be handled by middleware - if(blessed $error && ($error->can('as_psgi') || $error->can('code'))) { - $error->can('rethrow') ? $error->rethrow : croak $error; + if(blessed $_ && ($_->can('as_psgi') || $_->can('code'))) { + $_->can('rethrow') ? $_->rethrow : croak $_; } + chomp(my $error = $_); + $class->log->error(qq/Caught exception in engine "$error"/); }; $COUNT++;