Browse Source

增加异常处理

dev
李可松 4 years ago
parent
commit
54e56dcf91
  1. 9
      app/Exceptions/Handler.php

9
app/Exceptions/Handler.php

@ -75,6 +75,15 @@ class Handler extends ExceptionHandler
'status' => 500, 'status' => 500,
]); ]);
} }
//Exception
if ($e instanceof \Exception) {
return response()->json([
'code' => -1,
'msg' => $e->getMessage(),
'data' => [],
'status' => 500,
]);
}
return parent::render($request, $e); return parent::render($request, $e);
} }
} }
Loading…
Cancel
Save