|
@@ -61,12 +61,6 @@ class Errors extends \Exception
|
|
|
if (\Qii::getInstance()->request == null) {
|
|
|
\Qii::getInstance()->request = \Qii::getInstance()->getRequest();
|
|
|
}
|
|
|
- if (\Qii::getInstance()->request->getExtension() == 'json') {
|
|
|
- $code = $e->getCode();
|
|
|
- if ($code == 0) $code = 1;
|
|
|
- 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 : '');
|
|
|
$message[] = \Qii::i('Error code', $e->getCode()) . (IS_CLI ? QII_EOL : '');
|
|
|
$message[] = \Qii::i('Error description', $e->getMessage()) . (IS_CLI ? QII_EOL : '');
|
|
@@ -88,6 +82,7 @@ class Errors extends \Exception
|
|
|
if ($env == 'product' || (isset($appConfigure['errorPage']) && $appConfigure['errorPage'] && (isset($appConfigure['debug']) && $appConfigure['debug'] == 0))) {
|
|
|
list($controller, $action) = explode(':', $appConfigure['errorPage']);
|
|
|
$controllerCls = $controller;
|
|
|
+
|
|
|
if(substr($controller, 0, 1) != '\\') {
|
|
|
$controllerCls = Register::get(Consts::APP_DEFAULT_CONTROLLER_PREFIX) . '\\' . $controller;
|
|
|
}
|
|
@@ -107,6 +102,12 @@ class Errors extends \Exception
|
|
|
}
|
|
|
return \Qii::getInstance()->dispatcher->setRequest(\Qii::getInstance()->request)->dispatch($controller, $action, $e);
|
|
|
}
|
|
|
+ if (\Qii::getInstance()->request->getExtension() == 'json') {
|
|
|
+ $code = $e->getCode();
|
|
|
+ if ($code == 0) $code = 1;
|
|
|
+ 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;
|
|
|
+ }
|
|
|
ob_start();
|
|
|
include(join(DS, array(QII_DIR, 'Exceptions', 'View', 'error.php')));
|
|
|
$html = ob_get_contents();
|