diff --git a/lib/SimpleSAML/Error/Exception.php b/lib/SimpleSAML/Error/Exception.php index 8820448e8504a1eae5af4d389fba7d080af3bee0..fb8b62a1cdc0b4f4015b780147e8bfc0c888c7c3 100644 --- a/lib/SimpleSAML/Error/Exception.php +++ b/lib/SimpleSAML/Error/Exception.php @@ -92,6 +92,16 @@ class SimpleSAML_Error_Exception extends Exception { } + /** + * Retrieve the class of this exception. + * + * @return string The classname. + */ + public function getClass() { + return get_class($this); + } + + /** * Format this exception for logging. * @@ -105,7 +115,7 @@ class SimpleSAML_Error_Exception extends Exception { $e = $this; do { - $err = get_class($e) . ': ' . $e->getMessage(); + $err = $e->getClass() . ': ' . $e->getMessage(); if ($e === $this) { $ret[] = $err; } else { diff --git a/lib/SimpleSAML/Error/UnserializableException.php b/lib/SimpleSAML/Error/UnserializableException.php index 9a5995c04431c41dccc9da13dc6a355ccfc64200..00474404938c0f1d1b7f91e219ca2c61f6ae56e0 100644 --- a/lib/SimpleSAML/Error/UnserializableException.php +++ b/lib/SimpleSAML/Error/UnserializableException.php @@ -15,9 +15,23 @@ */ class SimpleSAML_Error_UnserializableException extends SimpleSAML_Error_Exception { + /** + * The classname of the original exception. + * + * @var string + */ + private $class; + + + /** + * Create a serializable exception representing an unserializable exception. + * + * @param Exception $original The original exception. + */ public function __construct(Exception $original) { - $msg = get_class($original) . ': ' . $original->getMessage(); + $this->class = get_class($original); + $msg = $original->getMessage(); $code = $original->getCode(); if (!is_int($code)) { @@ -30,4 +44,14 @@ class SimpleSAML_Error_UnserializableException extends SimpleSAML_Error_Exceptio $this->setBacktrace(SimpleSAML_Utilities::buildBacktrace($original)); } -} \ No newline at end of file + + /** + * Retrieve the class of this exception. + * + * @return string The classname. + */ + public function getClass() { + return $this->class; + } + +}