diff --git a/lib/SimpleSAML/Error/Error.php b/lib/SimpleSAML/Error/Error.php
index 30a6897b085387cb53ed2e0ce83e2018419912e7..46d2a83d3abe35baf63117b7920dfa86c69a02f1 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;
 	}