Skip to content

Commit

Permalink
assert tostring msg
Browse files Browse the repository at this point in the history
  • Loading branch information
chronolaw committed Apr 28, 2024
1 parent 482a266 commit 0526a2f
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions kong/clustering/rpc/json_rpc_v2.lua
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@ local ERROR_MSG = {


function _M.new_error(id, code, msg)
if not msg then
if msg then
msg = assert(tostring(msg))

else
msg = assert(ERROR_MSG[code], "unknown code: " .. tostring(code))
end

Expand All @@ -32,7 +35,7 @@ function _M.new_error(id, code, msg)
id = id,
error = {
code = code,
message = tostring(msg),
message = msg,
}
}
end
Expand Down

0 comments on commit 0526a2f

Please sign in to comment.