mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-25 12:43:09 +00:00
fixed mongodb werror return errmsg (#1271)
This commit is contained in:
@@ -333,14 +333,16 @@ function mongo_collection:insert(doc)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local function werror(r)
|
local function werror(r)
|
||||||
local ok = (r.ok == 1 and not r.writeErrors and not r.writeConcernError)
|
local ok = (r.ok == 1 and not r.writeErrors and not r.writeConcernError and not r.errmsg)
|
||||||
|
|
||||||
local err
|
local err
|
||||||
if not ok then
|
if not ok then
|
||||||
if r.writeErrors then
|
if r.writeErrors then
|
||||||
err = r.writeErrors[1].errmsg
|
err = r.writeErrors[1].errmsg
|
||||||
else
|
elseif r.writeConcernError then
|
||||||
err = r.writeConcernError.errmsg
|
err = r.writeConcernError.errmsg
|
||||||
|
else
|
||||||
|
err = r.errmsg
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return ok, err, r
|
return ok, err, r
|
||||||
|
|||||||
Reference in New Issue
Block a user