summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/SimpleSAML/Error/MetadataNotFound.php50
-rw-r--r--lib/SimpleSAML/Metadata/MetaDataStorageHandler.php2
2 files changed, 51 insertions, 1 deletions
diff --git a/lib/SimpleSAML/Error/MetadataNotFound.php b/lib/SimpleSAML/Error/MetadataNotFound.php
new file mode 100644
index 0000000..d079331
--- /dev/null
+++ b/lib/SimpleSAML/Error/MetadataNotFound.php
@@ -0,0 +1,50 @@
+<?php
+
+/**
+ * Error for missing metadata.
+ *
+ * @package simpleSAMLphp
+ * @version $Id$
+ */
+class SimpleSAML_Error_MetadataNotFound extends SimpleSAML_Error_Error {
+
+ /**
+ * The entityID we were unable to locate.
+ *
+ * @var string
+ */
+ private $entityId;
+
+
+ /**
+ * Create the error
+ *
+ * @param string $entityId The entityID we were unable to locate.
+ */
+ public function __construct($entityId) {
+ assert('is_string($entityId)');
+
+ parent::__construct('Unable to locate metadata for ' . var_export($entityId, TRUE) . '.');
+ $this->entityId = $entityId;
+ }
+
+
+ /**
+ * Show the error to the user.
+ *
+ * This function does not return.
+ */
+ public function show() {
+
+ header('HTTP/1.0 500 Internal Server Error');
+
+ $this->logError();
+
+ $globalConfig = SimpleSAML_Configuration::getInstance();
+ $t = new SimpleSAML_XHTML_Template($globalConfig, 'core:no_metadata.tpl.php');
+ $t->data['entityId'] = $this->entityId;
+ $t->show();
+ exit();
+ }
+
+}
diff --git a/lib/SimpleSAML/Metadata/MetaDataStorageHandler.php b/lib/SimpleSAML/Metadata/MetaDataStorageHandler.php
index 91c999c..2e4352e 100644
--- a/lib/SimpleSAML/Metadata/MetaDataStorageHandler.php
+++ b/lib/SimpleSAML/Metadata/MetaDataStorageHandler.php
@@ -286,7 +286,7 @@ class SimpleSAML_Metadata_MetaDataStorageHandler {
}
}
- throw new Exception('Unable to locate metadata for \'' . $index . '\' in set \'' . $set . '\'.');
+ throw new SimpleSAML_Error_MetadataNotFound($index);
}