error(-1, $msg, $exception); } else if ($exception instanceof TokenInvalidException) { $msg = __('非法的Token'); return api_response()->error(-1, $msg, $exception); } else if ($exception instanceof JWTException) { $msg = __('非法的Token'); return api_response()->error(-1, $msg, $exception); } else if ($exception instanceof ModelNotFoundException) { $msg = __('模型被UFO略走了O_O'); return api_response()->error(0, $msg, $exception); } else if ($exception instanceof ValidationException) { return api_response()->error(0, $exception->validator->errors()->first(), $exception); } else if ($exception instanceof NotFoundHttpException) { $msg = __('资源被火星人略走了>_<'); return api_response()->error(0, $msg, $exception); } else if ($exception instanceof MethodNotAllowedHttpException) { $msg = __('非法请求'); return api_response()->error(0, $msg, $exception); } else if ($exception instanceof UserNotDefinedException) { $msg = __('用户被外星人略走了'); return api_response()->error(0, $msg, $exception); } elseif ($exception instanceof AuthenticationException) { $msg = __('需要验证Token'); return api_response()->error(0, $msg, $exception); } return parent::render($request, $exception); } }