]> git.decadent.org.uk Git - maypole.git/blobdiff - lib/Maypole.pm
view exceptions and some code cleaning
[maypole.git] / lib / Maypole.pm
index 53e9be59cbe4afb0dcda50a24bfb1da219a54f03..4a5201127794ab8c8936cd322eeeb62de83395b1 100644 (file)
@@ -83,7 +83,7 @@ sub handler_guts {
     if ( my $error = $@ ) {
         $status = $r->call_exception($error);
         if ( $status != OK ) {
-            warn "caught model error: $error";
+            warn "caught authenticate error: $error";
             return $r->debug ? $r->view_object->error( $r, $error ) : ERROR;
         }
     }
@@ -106,7 +106,15 @@ sub handler_guts {
         }
     }
     if ( !$r->{output} ) {    # You might want to do it yourself
-        return $r->view_object->process($r);
+        eval { $status = $r->view_object->process($r) };
+        if ( my $error = $@ ) {
+            $status = $r->call_exception($error);
+            if ( $status != OK ) {
+                warn "caught view error: $error";
+                return $r->debug ? $r->view_object->error( $r, $error ) : ERROR;
+            }
+        }
+        return $status;
     }
     else { return OK; }
 }