Added class and method for catched exceptions messages
Sebastian Riedel [Sat, 10 Dec 2005 00:11:24 +0000 (00:11 +0000)]
Changes
lib/Catalyst.pm
t/live_engine_reponse_errors.t

diff --git a/Changes b/Changes
index 68e48e1..2f2fd89 100644 (file)
--- 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
index fa7ca6a..4b9ef99 100644 (file)
@@ -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);
index 7579135..de7f92b 100644 (file)
@@ -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'
     );
 }