Skip to content
Snippets Groups Projects
Commit b311f5e4 authored by Olav Morken's avatar Olav Morken
Browse files

SimpleSAML_Error_UnserializableException: Preserve classname for logging.

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@2483 44740490-163a-0410-bde0-09ae8108e29a
parent c2bb7546
No related branches found
No related tags found
No related merge requests found
...@@ -92,6 +92,16 @@ class SimpleSAML_Error_Exception extends Exception { ...@@ -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. * Format this exception for logging.
* *
...@@ -105,7 +115,7 @@ class SimpleSAML_Error_Exception extends Exception { ...@@ -105,7 +115,7 @@ class SimpleSAML_Error_Exception extends Exception {
$e = $this; $e = $this;
do { do {
$err = get_class($e) . ': ' . $e->getMessage(); $err = $e->getClass() . ': ' . $e->getMessage();
if ($e === $this) { if ($e === $this) {
$ret[] = $err; $ret[] = $err;
} else { } else {
......
...@@ -15,9 +15,23 @@ ...@@ -15,9 +15,23 @@
*/ */
class SimpleSAML_Error_UnserializableException extends SimpleSAML_Error_Exception { 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) { public function __construct(Exception $original) {
$msg = get_class($original) . ': ' . $original->getMessage(); $this->class = get_class($original);
$msg = $original->getMessage();
$code = $original->getCode(); $code = $original->getCode();
if (!is_int($code)) { if (!is_int($code)) {
...@@ -30,4 +44,14 @@ class SimpleSAML_Error_UnserializableException extends SimpleSAML_Error_Exceptio ...@@ -30,4 +44,14 @@ class SimpleSAML_Error_UnserializableException extends SimpleSAML_Error_Exceptio
$this->setBacktrace(SimpleSAML_Utilities::buildBacktrace($original)); $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;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment