SimpleSAML_Error_Exception::__construct PHP Method

__construct() public method

Note that the cause will be converted to a SimpleSAML_Error_UnserializableException unless it is a subclass of SimpleSAML_Error_Exception.
public __construct ( string $message, integer $code, Exception $cause = null )
$message string Exception message
$code integer Error code
$cause Exception The cause of this exception.
    public function __construct($message, $code = 0, Exception $cause = null)
    {
        assert('is_string($message)');
        assert('is_int($code)');
        parent::__construct($message, $code);
        $this->initBacktrace($this);
        if ($cause !== null) {
            $this->cause = SimpleSAML_Error_Exception::fromException($cause);
        }
    }

Usage Example

示例#1
0
 /**
  * Constructor for the assertion exception.
  *
  * Should only be called from the onAssertion handler.
  *
  * @param string|NULL $assertion  The assertion which failed, or NULL if the assert-function was
  *                                given an expression.
  */
 public function __construct($assertion = NULL)
 {
     assert('is_null($assertion) || is_string($assertion)');
     $msg = 'Assertion failed: ' . var_export($assertion, TRUE);
     parent::__construct($msg);
     $this->assertion = $assertion;
 }
All Usage Examples Of SimpleSAML_Error_Exception::__construct