XSErrorException
| 包 | XS |
|---|---|
| 继承关系 | class XSErrorException » XSException » Exception |
| 版本 | 1.0.0 |
| 源代码 | sdk/php/lib/XS.class.php |
XS 错误异常类定义, XS 所有操作过程发生错误均抛出该实例
Public 方法
| 名称 | 描述 | 定义于 |
|---|---|---|
| __construct() | 构造函数 | XSErrorException |
| __toString() | 将类对象转换成字符串 | XSErrorException |
| getCode() | Exception | |
| getFile() | Exception | |
| getLine() | Exception | |
| getMessage() | Exception | |
| getPrevious() | Exception | |
| getRelPath() | 取得相对当前的文件路径 | XSException |
| getTrace() | Exception | |
| getTraceAsString() | Exception |
方法明细
__construct()
方法
|
public void __construct(int $code, string $message, string $file, int $line, Exception $previous=NULL)
| ||
| $code | int | 出错代码 |
| $message | string | 出错信息 |
| $file | string | 出错所在文件 |
| $line | int | 出错所在的行数 |
| $previous | Exception | |
源码: sdk/php/lib/XS.class.php#L137 (显示)
public function __construct($code, $message, $file, $line, $previous = null)
{
$this->_file = $file;
$this->_line = $line;
if (version_compare(PHP_VERSION, '5.3.0', '>='))
parent::__construct($message, $code, $previous);
else
parent::__construct($message, $code);
}
构造函数 将 $file, $line 记录到私有属性在 __toString 中使用
__toString()
方法
|
public string __toString()
| ||
| {return} | string | 异常的简要描述信息 |
源码: sdk/php/lib/XS.class.php#L151 (显示)
public function __toString()
{
$string = '[' . __CLASS__ . '] ' . $this->getRelPath($this->_file) . '(' . $this->_line . '): ';
$string .= $this->getMessage() . '(' . $this->getCode() . ')';
return $string;
}
将类对象转换成字符串