From: Sebastian Riedel Date: Sat, 10 Dec 2005 00:11:24 +0000 (+0000) Subject: Added class and method for catched exceptions messages X-Git-Tag: 5.7099_04~779 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=commitdiff_plain;h=f59def827fbf8431cb6439d1365f0c176a9aa32f Added class and method for catched exceptions messages --- diff --git a/Changes b/Changes index 68e48e1..2f2fd89 100644 --- a/Changes +++ b/Changes @@ -1,6 +1,7 @@ This file documents the revision history for Perl extension Catalyst. 5.62 + - Added class and method for catched exceptions messages - Updated PAR support to use "make catalyst_par", packages are no longer written by Makefile.PL - Automatically determine Content-Length when serving a diff --git a/lib/Catalyst.pm b/lib/Catalyst.pm index fa7ca6a..4b9ef99 100644 --- a/lib/Catalyst.pm +++ b/lib/Catalyst.pm @@ -923,6 +923,7 @@ sub execute { push @{ $c->{stats} }, [ $action, sprintf( '%fs', $elapsed ) ]; } } + my $last = ${ $c->stack }[-1]; pop( @{ $c->stack } ); if ( my $error = $@ ) { @@ -931,7 +932,9 @@ sub execute { else { unless ( ref $error ) { chomp $error; - $error = qq/Caught exception "$error"/; + my $class = $last->class; + my $name = $last->name; + $error = qq/Caught exception in $class->$name "$error"/; } $c->error($error); $c->state(0); diff --git a/t/live_engine_reponse_errors.t b/t/live_engine_reponse_errors.t index 7579135..de7f92b 100644 --- a/t/live_engine_reponse_errors.t +++ b/t/live_engine_reponse_errors.t @@ -54,7 +54,7 @@ close STDERR; # i'm naughty :) ); like( $response->header('X-Catalyst-Error'), - qr/^Caught exception "I'm going to die!"$/, + qr/"I'm going to die!"$/, 'Catalyst Error' ); }