From 7745a955758cda0832432381ef4d0cea57018e9b Mon Sep 17 00:00:00 2001
From: Olav Morken <olav.morken@uninett.no>
Date: Wed, 9 Feb 2011 12:28:10 +0000
Subject: [PATCH] Error_UserAborted: Subclass Error_Error instead.

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@2738 44740490-163a-0410-bde0-09ae8108e29a
---
 dictionaries/errors.definition.json      |  6 ++++++
 lib/SimpleSAML/Error/UserAborted.php     | 21 ++++++++++++++-------
 modules/authmyspace/www/linkback.php     |  2 +-
 modules/authwindowslive/www/linkback.php |  2 +-
 4 files changed, 22 insertions(+), 9 deletions(-)

diff --git a/dictionaries/errors.definition.json b/dictionaries/errors.definition.json
index ded0d974a..7dd755b24 100644
--- a/dictionaries/errors.definition.json
+++ b/dictionaries/errors.definition.json
@@ -193,5 +193,11 @@
 	},
 	"descr_UNKNOWNCERT": {
 		"en": "Authentication failed: the certificate your browser sent is unknown"
+	},
+	"title_USERABORTED": {
+		"en": "Authentication aborted"
+	},
+	"descr_USERABORTED": {
+		"en": "The authentication was aborted by the user"
 	}
 }
diff --git a/lib/SimpleSAML/Error/UserAborted.php b/lib/SimpleSAML/Error/UserAborted.php
index 901992b53..14df771f1 100644
--- a/lib/SimpleSAML/Error/UserAborted.php
+++ b/lib/SimpleSAML/Error/UserAborted.php
@@ -1,13 +1,20 @@
 <?php
+
 /**
- * Exception indicating user aborting the authentication proces.
+ * Exception indicating user aborting the authentication process.
  *
- * @package simpleSAMLphp_base
+ * @package simpleSAMLphp
  * @version $Id$
- *
  */
-class SimpleSAML_Error_UserAborted extends SimpleSAML_Error_User{
-	
-}
+class SimpleSAML_Error_UserAborted extends SimpleSAML_Error_Error {
 
-?>
+	/**
+	 * Create the error
+	 *
+	 * @param Exception|NULL $cause  The exception that caused this error.
+	 */
+	public function __construct(Exception $cause = NULL) {
+		parent::__construct('USERABORTED', $cause);
+	}
+
+}
diff --git a/modules/authmyspace/www/linkback.php b/modules/authmyspace/www/linkback.php
index cc20f8b8f..93c45153c 100644
--- a/modules/authmyspace/www/linkback.php
+++ b/modules/authmyspace/www/linkback.php
@@ -15,7 +15,7 @@ $state = SimpleSAML_Auth_State::loadState($stateId, sspmod_authmyspace_Auth_Sour
 if (array_key_exists('oauth_problem', $_REQUEST)) {
 	// oauth_problem of 'user_refused' means user chose not to login with MySpace
 	if (strcmp($_REQUEST['oauth_problem'],'user_refused') == 0) {
-		$e = new SimpleSAML_Error_UserAborted('User aborted authentication.');
+		$e = new SimpleSAML_Error_UserAborted();
 		SimpleSAML_Auth_State::throwException($state, $e);
 	}
 
diff --git a/modules/authwindowslive/www/linkback.php b/modules/authwindowslive/www/linkback.php
index a8fe872dc..7ae42661f 100644
--- a/modules/authwindowslive/www/linkback.php
+++ b/modules/authwindowslive/www/linkback.php
@@ -24,7 +24,7 @@ if (array_key_exists('wrap_verification_code', $_REQUEST)) {
 	// wrap_error_reason = 'user_denied' means user chose not to login with LiveID
 	// redirect them to their original page so they can choose another auth mechanism
 	if ($_REQUEST['wrap_error_reason'] === 'user_denied') {
-		$e = new SimpleSAML_Error_UserAborted('User aborted authentication.');
+		$e = new SimpleSAML_Error_UserAborted();
 		SimpleSAML_Auth_State::throwException($state, $e);
 	}
 
-- 
GitLab