X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=blobdiff_plain;f=lib%2FCatalyst.pm;h=32aea5709f08eba01fff1be4f15696d670ea1769;hp=93b6fe9b20869130c9de0a606eae55880d0e4ee8;hb=2a8fe68af0b4bd068049d6bab0ac5b73b4e0600c;hpb=1893c1946e7cc5bb493241d8c9e783a02147f8b4 diff --git a/lib/Catalyst.pm b/lib/Catalyst.pm old mode 100755 new mode 100644 index 93b6fe9..32aea57 --- a/lib/Catalyst.pm +++ b/lib/Catalyst.pm @@ -127,7 +127,7 @@ __PACKAGE__->stats_class('Catalyst::Stats'); __PACKAGE__->_encode_check(Encode::FB_CROAK | Encode::LEAVE_SRC); # Remember to update this in Catalyst::Runtime as well! -our $VERSION = '5.90069_004'; +our $VERSION = '5.90077'; sub import { my ( $class, @arguments ) = @_; @@ -1775,7 +1775,16 @@ sub execute { if ( my $error = $@ ) { #rethow if this can be handled by middleware - if(blessed $error && ($error->can('as_psgi') || $error->can('code'))) { + if( + !$c->config->{always_catch_http_exceptions} && + blessed $error && ( + $error->can('as_psgi') || + ( + $error->can('code') && + $error->code =~m/^[1-5][0-9][0-9]$/ + ) + ) + ) { foreach my $err (@{$c->error}) { $c->log->error($err); } @@ -1957,6 +1966,7 @@ sub finalize_error { } else { my ($error) = @{$c->error}; if( + !$c->config->{always_catch_http_exceptions} && blessed $error && ($error->can('as_psgi') || $error->can('code')) ) { @@ -2101,7 +2111,16 @@ sub handle_request { $status = $c->finalize; } catch { #rethow if this can be handled by middleware - if(blessed $_ && ($_->can('as_psgi') || $_->can('code'))) { + if( + !$class->config->{always_catch_http_exceptions} && + blessed($_) && ( + $_->can('as_psgi') || + ( + $_->can('code') && + $_->code =~m/^[1-5][0-9][0-9]$/ + ) + ) + ) { $_->can('rethrow') ? $_->rethrow : croak $_; } chomp(my $error = $_); @@ -3071,6 +3090,7 @@ sub _handle_unicode_decoding { return unless defined $value; + ## I think this mess is to support the old nested if ( ref $value eq 'ARRAY' ) { foreach ( @$value ) { $_ = $self->_handle_unicode_decoding($_); @@ -3090,6 +3110,8 @@ sub _handle_unicode_decoding { sub _handle_param_unicode_decoding { my ( $self, $value ) = @_; + return unless defined $value; # not in love with just ignoring undefs - jnap + my $enc = $self->encoding; return try { Encode::is_utf8( $value ) ? @@ -3487,6 +3509,13 @@ There are a number of 'base' config variables which can be set: =item * +C - As of version 5.90060 Catalyst +rethrows errors conforming to the interface described by +L and lets the middleware deal with it. +Set true to get the deprecated behaviour and have Catakyst catch HTTP exceptions. + +=item * + C - The default model picked if you say C<< $c->model >>. See L<< /$c->model($name) >>. =item *