]> git.decadent.org.uk Git - maypole.git/blobdiff - lib/Maypole.pm
simon cozens debug page and improved exceptions
[maypole.git] / lib / Maypole.pm
index dbae33be3580d65f667d6e79044ef9b30ca94634..85d471f33f43369b3d94370cc672aad065d47d10 100644 (file)
@@ -515,7 +515,7 @@ sub handler_guts
     
     if ( my $error = $@ ) 
     {
-        $status = $self->call_exception($error);
+        $status = $self->call_exception($error, "authentication");
         
         if ( $status != OK ) 
         {
@@ -542,7 +542,7 @@ sub handler_guts
         
         if ( my $error = $@ ) 
         {
-            $status = $self->call_exception($error);
+            $status = $self->call_exception($error, "model");
             
             if ( $status != OK ) 
             {
@@ -595,7 +595,7 @@ sub __call_process_view
     
     if ( my $error = $@ ) 
     {
-        $status = $self->call_exception($error);
+        $status = $self->call_exception($error, "view");
         
         if ( $status != OK ) 
         {
@@ -823,16 +823,16 @@ exception method of your Maypole application.
 
 sub call_exception 
 {
-    my ($self, $error) = @_;
+    my ($self, $error, $when) = @_;
 
     # Check if we have a model class with an exception() to delegate to
     if ( $self->model_class && $self->model_class->can('exception') )
     {
-        my $status = $self->model_class->exception( $self, $error );
+        my $status = $self->model_class->exception( $self, $error, $when );
         return $status if $status == OK;
     }
     
-    return $self->exception($error);
+    return $self->exception($error, $when);
 }
 
 
@@ -845,7 +845,14 @@ processed.
 
 =cut
 
-sub exception { return ERROR }
+sub exception { 
+    my ($self, $error, $when) = @_;
+    if ($self->view_object->can("report_error") and $self->debug) {
+        $self->view_object->report_error($self, $error, $when);
+        return OK;
+    }
+    return ERROR;
+}
 
 =item additional_data