Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update exception.init.php #12

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions initphp/init/exception.init.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class exceptionInit extends Exception{
*/
public static function cliErrorTpl($e) {
$InitPHP_conf = InitPHP::getConfig();
$msg = $e->message;
$msg = $e->getMessage();
$mainErrorCode = $e->getLineCode($e->getFile(), $e->getLine());
self::_recordError($msg,$e->getFile(),$e->getLine(),trim($mainErrorCode));
//如果debug关闭,则不显示debug错误信息
Expand Down Expand Up @@ -47,14 +47,14 @@ public static function cliErrorTpl($e) {
*/
public static function errorTpl($e) {
$InitPHP_conf = InitPHP::getConfig();
$msg = $e->message;
$msg = $e->getMessage();
$mainErrorCode = self::getLineCode($e->getFile(), $e->getLine());
self::_recordError($msg, $e->getFile(), $e->getLine(), trim($mainErrorCode));
if (!$InitPHP_conf['is_debug'] && $e->code == 10000) {
$msg = '系统繁忙,请稍后再试';
}
if (self::is_ajax()) {
$arr = array('status' => 0, 'message' => $msg, 'data' => array('code' => $e->code));
$arr = array('status' => 0, 'message' => $msg, 'data' => array('code' => $e->getCode()));
echo json_encode($arr);
} else {
//如果debug关闭,则不显示debug错误信息
Expand Down Expand Up @@ -154,4 +154,4 @@ private static function _recordError($msg, $file, $line, $code){
$string.='['.date('Y-m-d h:i:s').']msg:'.$msg.';file:'.$file.';line:'.$line.';code:'.$code.'';
InitPHP::log($string, ERROR); //记录日志
}
}
}