diff options
author | Olav Morken <olav.morken@uninett.no> | 2010-08-12 09:00:57 +0000 |
---|---|---|
committer | Olav Morken <olav.morken@uninett.no> | 2010-08-12 09:00:57 +0000 |
commit | d50fcc9c00f86d2c3a5d5ad51d263e409e99cc0c (patch) | |
tree | 0fd59e4dd3228f4cb6acdda767eb940800ff0763 /lib/SimpleSAML | |
parent | d4fe2dbf51ac8248b9055cb86c94154e2cd387e8 (diff) | |
download | simplesamlphp-d50fcc9c00f86d2c3a5d5ad51d263e409e99cc0c.zip simplesamlphp-d50fcc9c00f86d2c3a5d5ad51d263e409e99cc0c.tar.gz simplesamlphp-d50fcc9c00f86d2c3a5d5ad51d263e409e99cc0c.tar.bz2 |
New error page for metadata not found.
git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@2516 44740490-163a-0410-bde0-09ae8108e29a
Diffstat (limited to 'lib/SimpleSAML')
-rw-r--r-- | lib/SimpleSAML/Error/MetadataNotFound.php | 50 | ||||
-rw-r--r-- | lib/SimpleSAML/Metadata/MetaDataStorageHandler.php | 2 |
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); } |