report($e); // 其他错误交给系统处理 if ($e instanceof ValidateException) return app('json')->fail($e->getMessage()); else if ($e instanceof DataNotFoundException) return app('json')->fail(isDebug() ? $e->getMessage() : '数据不存在'); else if ($e instanceof ModelNotFoundException) return app('json')->fail(isDebug() ? $e->getMessage() : '数据不存在'); else if ($e instanceof PDOException) return app('json')->fail(isDebug() ? $e->getMessage() : '数据库操作失败', isDebug() ? $e->getData() : []); else if ($e instanceof ErrorException) return app('json')->fail(isDebug() ? $e->getMessage() : '系统错误', isDebug() ? $e->getData() : []); else if ($e instanceof \PDOException) return app('json')->fail(isDebug() ? $e->getMessage() : '数据库连接失败'); else if ($e instanceof \EasyWeChat\Core\Exceptions\HttpException) return app('json')->fail($e->getMessage()); return parent::render($request, $e); } }