2015-01-08 22:00:03 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace RainLoop\Exceptions;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @category RainLoop
|
|
|
|
* @package Exceptions
|
|
|
|
*/
|
|
|
|
class ClientException extends Exception
|
|
|
|
{
|
|
|
|
/**
|
2015-12-15 12:02:30 +08:00
|
|
|
* @var boolen
|
|
|
|
*/
|
|
|
|
private $bLogoutOnException;
|
|
|
|
|
|
|
|
/**
|
2015-01-08 22:00:03 +08:00
|
|
|
* @var string
|
|
|
|
*/
|
|
|
|
private $sAdditionalMessage;
|
|
|
|
|
2015-12-15 12:02:30 +08:00
|
|
|
/**
|
|
|
|
* @param int $iCode
|
|
|
|
* @param \Exception $oPrevious = null
|
|
|
|
* @param string $sAdditionalMessage = ''
|
|
|
|
* @param boolean $bLogoutOnException = false
|
|
|
|
*/
|
|
|
|
public function __construct($iCode, $oPrevious = null, $sAdditionalMessage = '', $bLogoutOnException = false)
|
2015-01-08 22:00:03 +08:00
|
|
|
{
|
|
|
|
parent::__construct(\RainLoop\Notifications::GetNotificationsMessage($iCode, $oPrevious),
|
|
|
|
$iCode, $oPrevious);
|
|
|
|
|
|
|
|
$this->sAdditionalMessage = $sAdditionalMessage;
|
2015-12-15 12:02:30 +08:00
|
|
|
|
|
|
|
$this->setLogoutOnException($bLogoutOnException);
|
2015-01-08 22:00:03 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
public function getAdditionalMessage()
|
|
|
|
{
|
|
|
|
return $this->sAdditionalMessage;
|
|
|
|
}
|
2015-12-15 12:02:30 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @return boolen
|
|
|
|
*/
|
|
|
|
public function getLogoutOnException()
|
|
|
|
{
|
|
|
|
return $this->bLogoutOnException;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param boolean $bLogoutOnException
|
|
|
|
* @param string $sAdditionalLogoutMessage = ''
|
|
|
|
*
|
|
|
|
* @return ClientException
|
|
|
|
*/
|
|
|
|
public function setLogoutOnException($bLogoutOnException, $sAdditionalLogoutMessage = '')
|
|
|
|
{
|
|
|
|
$this->bLogoutOnException = !!$bLogoutOnException;
|
|
|
|
|
|
|
|
$this->sAdditionalMessage = $sAdditionalLogoutMessage;
|
|
|
|
|
|
|
|
return $this;
|
|
|
|
}
|
2015-01-08 22:00:03 +08:00
|
|
|
}
|