chore: 重写初始提交(清空历史,整理后全量提交)

This commit is contained in:
ywxapp
2026-08-16 16:54:14 +08:00
commit 6c1a106bc1
1808 changed files with 238144 additions and 0 deletions
+68
View File
@@ -0,0 +1,68 @@
<?php
// +----------------------------------------------------------------------
// | YwxApp [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2026-2036 http://ywxapp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: ywxapp<admin@ywxapp.cn>
// +----------------------------------------------------------------------
namespace ywxapp\handler;
use Throwable;
use think\Response;
use think\exception\Handle;
use think\exception\HttpException;
use think\exception\ValidateException;
use think\exception\HttpResponseException;
use think\db\exception\DataNotFoundException;
use think\db\exception\ModelNotFoundException;
/**
* 应用异常处理类.
*/
class ExceptionHandle extends Handle
{
/**
* 不需要记录信息(日志)的异常类列表.
*
* @var array
*/
protected $ignoreReport = [
HttpException::class,
HttpResponseException::class,
ModelNotFoundException::class,
DataNotFoundException::class,
ValidateException::class,
];
/**
* 记录异常信息(包括日志或者其它方式记录).
*
* @param Throwable $exception
*
* @return void
*/
public function report(Throwable $exception): void
{
event('app_exception_report', ['exception'=>$exception,'ignoreReport'=>$this->ignoreReport]);
// 使用内置的方式记录异常日志
parent::report($exception);
}
/**
* Render an exception into an HTTP response.
*
* @param \think\Request $request
* @param Throwable $e
*
* @return Response
*/
public function render($request, Throwable $e): Response
{
event('app_exception', $e);
// 添加自定义异常处理机制
// 其他错误交给系统处理
return parent::render($request, $e);
}
}