]> git.decadent.org.uk Git - maypole.git/blobdiff - lib/Maypole.pm
exceptions for authenticate
[maypole.git] / lib / Maypole.pm
index 4a5a8e79cb82a5a982b150c0c599cf15a2ed74ed..11fbe52791014fda2e9c0cb6af9abbf187fd1748 100644 (file)
@@ -78,7 +78,15 @@ sub handler_guts {
     }
 
     # We authenticate every request, needed for proper session management
-    my $status = $r->call_authenticate;
+    my $status;
+    eval { $status = $r->call_authenticate };
+    if ( my $error = $@ ) {
+        $status = $r->call_exception($error);
+        if ( $status != OK ) {
+            warn "caught model error: $error";
+            return $r->debug ? $r->view_object->error( $r, $error ) : ERROR;
+        }
+    }
     if ( $r->debug and $status != OK and $status != DECLINED ) {
         $r->view_object->error( $r,
             "Got unexpected status $status from calling authentication" );