From f3dc5580e20319565a2cec261349066e9359f031 Mon Sep 17 00:00:00 2001
From: Olav Morken <olav.morken@uninett.no>
Date: Wed, 7 Oct 2009 09:11:40 +0000
Subject: [PATCH] SimpleSAML_Error_Error: Set exception message to error code.

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@1825 44740490-163a-0410-bde0-09ae8108e29a
---
 lib/SimpleSAML/Error/Error.php | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/lib/SimpleSAML/Error/Error.php b/lib/SimpleSAML/Error/Error.php
index 30a6897b0..46d2a83d3 100644
--- a/lib/SimpleSAML/Error/Error.php
+++ b/lib/SimpleSAML/Error/Error.php
@@ -36,6 +36,21 @@ class SimpleSAML_Error_Error extends Exception {
 
 		assert('is_string($errorCode) || is_array($errorCode)');
 
+		if (is_array($errorCode)) {
+			$msg = $errorCode[0] . '(';
+			foreach ($errorCode as $k => $v) {
+				if ($k === 0) {
+					continue;
+				}
+
+				$msg .= var_export($k, TRUE) . ' => ' . var_export($v, TRUE) . ', ';
+			}
+			$msg = substr($msg, 0, -2) . ')';
+		} else {
+			$msg = $errorCode;
+		}
+		parent::__construct($msg);
+
 		$this->errorCode = $errorCode;
 		$this->cause = $cause;
 	}
-- 
GitLab