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