Skip to content

Commit 2f833d4

Browse files
net.box: separately handle box.error in handle_eval_result
Currently, in the error case, `handle_eval_result` constructs a new error passing the error it receives as an argument (which can be a box.error) to the message argument of the `box.error` constructor. Then, during `box.error` construction, if the error argument of `handle_eval_result` was a `box.error`, it is converted to a string using its string conversion metamethod, which currently returns the error's message, losing the rest of the error's information. But in scope of tarantool#9105, we are going to increase the verbosity of the string conversion metamethod, and it will not return the error's message. To adjust to this new behaviour, let's separately handle `box.error` in `handle_eval_result`, and create the same error, but with the `ER_PROC_LUA` code. Needed for tarantool#9105 NO_CHANGELOG=<internal change> NO_TEST=<internal change> NO_DOC=<internal change>
1 parent 97bfc2f commit 2f833d4

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/box/lua/net_box.lua

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1365,7 +1365,14 @@ end
13651365
local function handle_eval_result(status, ...)
13661366
if not status then
13671367
rollback()
1368-
return box.error(E_PROC_LUA, (...))
1368+
local err = ...
1369+
if type(err) ~= 'cdata' then
1370+
box.error(E_PROC_LUA, err)
1371+
end
1372+
-- We assume the error is a `box.error` object.
1373+
err = err:unpack()
1374+
err.code = E_PROC_LUA
1375+
return box.error(err)
13691376
end
13701377
local results = {...}
13711378
for i = 1, select('#', ...) do

0 commit comments

Comments
 (0)