Skip to content
Snippets Groups Projects
Commit ec772515 authored by Kurdakov Alexander's avatar Kurdakov Alexander Committed by Alexander Kurdakov
Browse files

fix: public lua functions should fail with error


Previously some public lua functions in core-router.lua failed
returning nil instead of an error. As a result in a case of error
rust code treated it as success, but failed to pop expected results
from lua stack. So, instead of a real error user got lua reading
errors. Fixed.

Co-authored-by: Denis Smirnov's avatarDenis Smirnov <sd@picodata.io>
parent 2859cbdb
No related branches found
No related tags found
1 merge request!1414sbroad import
......@@ -308,7 +308,11 @@ local function multi_storage_dql(uuid_to_args, func, handler, opts, tier_name)
f:discard()
end
end
return nil, err, err_uuid
local msg = "Unknown error"
if err ~= nil and err.message ~= nil then
msg = err.message
end
error(lerror.make("Error on replicaset " .. err_uuid .. ": " .. msg))
end
_G.group_buckets_by_replicasets = function(buckets, tier_name)
......@@ -317,7 +321,7 @@ _G.group_buckets_by_replicasets = function(buckets, tier_name)
for _, bucket_id in pairs(buckets) do
local rs, err = router:route(bucket_id)
if err ~= nil then
return nil, err
error(err)
end
local uuid = rs.uuid
if map[uuid] then
......@@ -336,7 +340,7 @@ _G.get_replicasets_from_buckets = function(buckets, tier_name)
for _, bucket_id in pairs(buckets) do
local rs, err = router:route(bucket_id)
if err ~= nil then
return nil, err
error(err)
end
local uuid = rs.uuid
if not map[uuid] then
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment