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

Add exception for serializing unserializable exceptions.

The SimpleSAML_Error_Exception class is a base class for serializable
exceptions. This patch adds SimpleSAML_Error_UnserializableException.
That class saves some of the information from an Exception and saves it
in an serializable exception.

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@1564 44740490-163a-0410-bde0-09ae8108e29a
parent db3b9ed6
No related branches found
No related tags found
No related merge requests found
<?php
/**
* Class for saving normal exceptions for serialization.
*
* This class is used by the SimpleSAML_Auth_State class when it needs
* to serialize an exception which doesn't subclass the
* SimpleSAML_Error_Exception class.
*
* It creates a new exception which contains the backtrace and message
* of the original exception.
*
* @package simpleSAMLphp
* @version $Id$
*/
class SimpleSAML_Error_UnserializableException extends SimpleSAML_Error_Exception {
public function __construct(Exception $original) {
$msg = get_class($original) . ': ' . $original->getMessage();
$code = $original->getCode();
parent::__construct($msg, $code);
$this->setBacktrace(SimpleSAML_Utilities::buildBacktrace($original));
}
}
\ No newline at end of file
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