From f09ee1fbe698cb0ec5adb8793ed6b754e8530a96 Mon Sep 17 00:00:00 2001
From: Olav Morken <olav.morken@uninett.no>
Date: Mon, 13 Jul 2009 06:18:08 +0000
Subject: [PATCH] Auth_Default: Handle exceptions thrown in the authenticate
 function.

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@1573 44740490-163a-0410-bde0-09ae8108e29a
---
 lib/SimpleSAML/Auth/Default.php | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/lib/SimpleSAML/Auth/Default.php b/lib/SimpleSAML/Auth/Default.php
index 5b60c90dc..a71358c96 100644
--- a/lib/SimpleSAML/Auth/Default.php
+++ b/lib/SimpleSAML/Auth/Default.php
@@ -62,7 +62,14 @@ class SimpleSAML_Auth_Default {
 			throw new Exception('Invalid authentication source: ' . $authId);
 		}
 
-		$as->authenticate($state);
+		try {
+			$as->authenticate($state);
+		} catch (SimpleSAML_Error_Exception $e) {
+			SimpleSAML_Auth_State::throwException($state, $e);
+		} catch (Exception $e) {
+			$e = new SimpleSAML_Error_UnserializableException($e);
+			SimpleSAML_Auth_State::throwException($state, $e);
+		}
 		self::loginCompleted($state);
 	}
 
-- 
GitLab