兼容修改
This commit is contained in:
@@ -14,6 +14,7 @@
|
|||||||
|
|
||||||
namespace support;
|
namespace support;
|
||||||
|
|
||||||
|
use app\exception\MyBusinessException;
|
||||||
use app\exception\SysException;
|
use app\exception\SysException;
|
||||||
use Throwable;
|
use Throwable;
|
||||||
use Webman\Exception\ExceptionHandler;
|
use Webman\Exception\ExceptionHandler;
|
||||||
@@ -34,13 +35,15 @@ class MyExceptionHandle extends ExceptionHandler implements ExceptionHandlerInte
|
|||||||
|
|
||||||
public function report(Throwable $exception)
|
public function report(Throwable $exception)
|
||||||
{
|
{
|
||||||
Log::error("捕获到全局异常,异常信息: ".$exception->getMessage());
|
|
||||||
Log::error($exception->getTraceAsString());
|
|
||||||
parent::report($exception);
|
parent::report($exception);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function render(Request $request, Throwable $exception): Response
|
public function render(Request $request, Throwable $exception): Response
|
||||||
{
|
{
|
||||||
|
if (!($exception instanceof MyBusinessException)) {
|
||||||
|
Log::error("捕获到全局异常,异常信息: ".$exception->getMessage());
|
||||||
|
Log::error($exception->getTraceAsString());
|
||||||
|
}
|
||||||
return json( [
|
return json( [
|
||||||
'code' => -1,
|
'code' => -1,
|
||||||
'message' => $exception->getMessage(),
|
'message' => $exception->getMessage(),
|
||||||
|
|||||||
Reference in New Issue
Block a user