mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-07 15:12:48 +08:00
改进系统异常的语言包提示
This commit is contained in:
@@ -17,6 +17,7 @@ return [
|
|||||||
'Parse error' => '语法解析错误',
|
'Parse error' => '语法解析错误',
|
||||||
'Type error' => '类型错误',
|
'Type error' => '类型错误',
|
||||||
'Fatal error' => '致命错误',
|
'Fatal error' => '致命错误',
|
||||||
|
'syntax error' => '语法错误',
|
||||||
|
|
||||||
// 框架核心错误提示
|
// 框架核心错误提示
|
||||||
'dispatch type not support' => '不支持的调度类型',
|
'dispatch type not support' => '不支持的调度类型',
|
||||||
|
|||||||
@@ -14,7 +14,6 @@ namespace think\exception;
|
|||||||
use Exception;
|
use Exception;
|
||||||
use think\App;
|
use think\App;
|
||||||
use think\Config;
|
use think\Config;
|
||||||
use think\Console;
|
|
||||||
use think\console\Output;
|
use think\console\Output;
|
||||||
use think\Lang;
|
use think\Lang;
|
||||||
use think\Log;
|
use think\Log;
|
||||||
@@ -44,13 +43,13 @@ class Handle
|
|||||||
'message' => $this->getMessage($exception),
|
'message' => $this->getMessage($exception),
|
||||||
'code' => $this->getCode($exception),
|
'code' => $this->getCode($exception),
|
||||||
];
|
];
|
||||||
$log = "[{$data['code']}]{$data['message']}[{$data['file']}:{$data['line']}]";
|
$log = "[{$data['code']}]{$data['message']}[{$data['file']}:{$data['line']}]";
|
||||||
} else {
|
} else {
|
||||||
$data = [
|
$data = [
|
||||||
'code' => $this->getCode($exception),
|
'code' => $this->getCode($exception),
|
||||||
'message' => $this->getMessage($exception),
|
'message' => $this->getMessage($exception),
|
||||||
];
|
];
|
||||||
$log = "[{$data['code']}]{$data['message']}";
|
$log = "[{$data['code']}]{$data['message']}";
|
||||||
}
|
}
|
||||||
|
|
||||||
Log::record($log, 'error');
|
Log::record($log, 'error');
|
||||||
@@ -210,11 +209,15 @@ class Handle
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (strpos($message, ':')) {
|
if (strpos($message, ':')) {
|
||||||
$name = strstr($message, ':', true);
|
$name = strstr($message, ':', true);
|
||||||
return Lang::has($name) ? Lang::get($name) . ' ' . strstr($message, ':') : $message;
|
$message = Lang::has($name) ? Lang::get($name) . strstr($message, ':') : $message;
|
||||||
} else {
|
} elseif (strpos($message, ',')) {
|
||||||
return Lang::has($message) ? Lang::get($message) : $message;
|
$name = strstr($message, ',', true);
|
||||||
|
$message = Lang::has($name) ? Lang::get($name) . ':' . substr(strstr($message, ','), 1) : $message;
|
||||||
|
} elseif (Lang::has($message)) {
|
||||||
|
$message = Lang::get($message);
|
||||||
}
|
}
|
||||||
|
return $message;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user