fix:更新已知bug,优化代码
This commit is contained in:
@@ -5,23 +5,33 @@ namespace app\common\exception;
|
||||
use app\common\model\system\SystemLog;
|
||||
use Psr\SimpleCache\InvalidArgumentException;
|
||||
use support\exception\BusinessException;
|
||||
use think\db\exception\DataNotFoundException;
|
||||
use think\db\exception\DbException;
|
||||
use think\db\exception\ModelNotFoundException;
|
||||
use Webman\Exception\ExceptionHandler;
|
||||
use Webman\Http\Request;
|
||||
use Webman\Http\Response;
|
||||
use Throwable;
|
||||
|
||||
class ExceptionHandle extends \Webman\Exception\ExceptionHandler
|
||||
class ExceptionHandle extends ExceptionHandler
|
||||
{
|
||||
public $dontReport = [
|
||||
BusinessException::class,
|
||||
];
|
||||
|
||||
/**
|
||||
*
|
||||
* @param Throwable $exception
|
||||
* @return void|mixed
|
||||
* @throws DataNotFoundException
|
||||
* @throws DbException
|
||||
* @throws ModelNotFoundException
|
||||
*/
|
||||
public function report(Throwable $exception)
|
||||
{
|
||||
|
||||
try {
|
||||
|
||||
if (saenv('system_exception') && !empty($exception->getMessage())) {
|
||||
|
||||
if (saenv('system_exception')
|
||||
&& !empty($exception->getMessage())) {
|
||||
$data = [
|
||||
'module' => request()->app,
|
||||
'controller' => request()->controller,
|
||||
@@ -32,11 +42,9 @@ class ExceptionHandle extends \Webman\Exception\ExceptionHandler
|
||||
'ip' => request()->getRealIp(),
|
||||
'name' => session('AdminLogin.name'),
|
||||
];
|
||||
|
||||
if (empty($data['name'])) {
|
||||
$data['name'] = 'system';
|
||||
}
|
||||
|
||||
$data['type'] = 1;
|
||||
$data['code'] = $exception->getCode();
|
||||
$data['file'] = $exception->getFile();
|
||||
@@ -50,6 +58,11 @@ class ExceptionHandle extends \Webman\Exception\ExceptionHandler
|
||||
parent::report($exception);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Throwable $exception
|
||||
* @param Request $request
|
||||
* @return Response
|
||||
*/
|
||||
public function render(Request $request, Throwable $exception): Response
|
||||
{
|
||||
if (!file_exists(root_path(). '.env')) {
|
||||
|
||||
Reference in New Issue
Block a user