From 54e56dcf91a11792f36b89702fbabb45a0eebeb8 Mon Sep 17 00:00:00 2001 From: liapples Date: Wed, 28 Jul 2021 22:59:26 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=BC=82=E5=B8=B8=E5=A4=84?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Exceptions/Handler.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php index a6d5381..e8750db 100644 --- a/app/Exceptions/Handler.php +++ b/app/Exceptions/Handler.php @@ -75,6 +75,15 @@ class Handler extends ExceptionHandler 'status' => 500, ]); } + //Exception + if ($e instanceof \Exception) { + return response()->json([ + 'code' => -1, + 'msg' => $e->getMessage(), + 'data' => [], + 'status' => 500, + ]); + } return parent::render($request, $e); } }