fix(etcd): check res.body.error before accessing the data (#4371)

Signed-off-by: spacewander <spacewanderlzx@gmail.com>
This commit is contained in:
罗泽轩 2021-06-04 10:02:59 +08:00 committed by GitHub
parent c61261af8d
commit e4f616be07
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -104,6 +104,11 @@ function _M.get_format(res, real_key, is_dir, formatter)
return nil, "etcd forbidden code: 403"
end
if res.body.error then
-- other errors, like "grpc: received message larger than max"
return nil, res.body.error
end
res.headers["X-Etcd-Index"] = res.body.header.revision
if not res.body.kvs then