no message

This commit is contained in:
kuaifan
2021-06-15 15:08:27 +08:00
parent a644d9ec02
commit 0926c532ab
9 changed files with 169 additions and 436 deletions

View File

@@ -50,8 +50,10 @@ class Handler extends ExceptionHandler
*/
public function render($request, Throwable $e)
{
if ($e instanceof ModelNotFoundException) {
return response()->json(Base::retError('数据不存在'));
if ($e instanceof ApiException) {
return response()->json(Base::retError($e->getMessage(), $e->getData(), $e->getCode()));
} elseif ($e instanceof ModelNotFoundException) {
return response()->json(Base::retError('Interface error'));
}
return parent::render($request, $e);
}