|
@@ -14,6 +14,9 @@ if (class_exists('\Qii\Exceptions\Errors', false)) {
|
|
|
class Errors extends \Exception
|
|
|
{
|
|
|
const VERSION = '1.2';
|
|
|
+ public function __construct($message, $code = 500, \Exception $previous = null){
|
|
|
+ parent::__construct($message, $code, $previous);
|
|
|
+ }
|
|
|
/**
|
|
|
* 获取两个文件的相对路径
|
|
|
* @param String $cur
|
|
@@ -61,7 +64,7 @@ class Errors extends \Exception
|
|
|
if (\Qii::getInstance()->request->getExtension() == 'json') {
|
|
|
$code = $e->getCode();
|
|
|
if ($code == 0) $code = 1;
|
|
|
- echo json_encode(array('code' => $code, 'line' => $e->getFile() . ' line :' . $e->getLine(), 'msg' => strip_tags($e->getMessage())), JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_QUOT | JSON_HEX_AMP | JSON_UNESCAPED_UNICODE);
|
|
|
+ echo json_encode(array('code' => $code, 'line' => self::getRelatePath($_SERVER['SCRIPT_FILENAME'], $e->getFile()) . ' line :' . $e->getLine(), 'msg' => strip_tags($e->getMessage())), JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_QUOT | JSON_HEX_AMP | JSON_UNESCAPED_UNICODE);
|
|
|
return;
|
|
|
}
|
|
|
$message[] = (IS_CLI ? QII_EOL : '') . \Qii::i('Error file', self::getRelatePath($_SERVER['SCRIPT_FILENAME'], $e->getFile())) . (IS_CLI ? QII_EOL : '');
|