Skip to content

Commit 53389a8

Browse files
Totktonadakyukhin
authored andcommitted
Re-raise an error from a remote server in :eval()
Otherwise we can miss the original error message, but fail somewhere else at attempt to use unexpected `{error = <...>}` value. It is better to fail faster, but with more relevant message. Part of tarantool/tarantool-qa#128
1 parent 3aa4666 commit 53389a8

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

test_run.lua

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,15 @@ end
2828
local eval_cmd = 'eval %s "%s"'
2929

3030
local function eval(self, node, expr)
31-
return self:cmd(eval_cmd:format(node, expr))
31+
local result = self:cmd(eval_cmd:format(node, expr))
32+
-- We always receive an array of results to handle Lua's
33+
-- multireturn.
34+
assert(type(result) == 'table')
35+
-- Re-raise Lua error from a remote instance.
36+
if type(result[1]) == 'table' and result[1].error ~= nil then
37+
error(result[1].error, 0)
38+
end
39+
return result
3240
end
3341

3442
local get_param_cmd = 'eval %s "return box.info%s"'

0 commit comments

Comments
 (0)