Skip to content

Commit

Permalink
internal: master conn check for get space utils
Browse files Browse the repository at this point in the history
Added validation of the connection to the `utils.get_space`
method before receiving the space through the connection.

Closes #331
  • Loading branch information
GRISHNOV committed Dec 28, 2022
1 parent 733528b commit c80b0ac
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions crud/common/utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,12 @@ end

function utils.get_space(space_name, replicasets)
local replicaset = select(2, next(replicasets))

if replicaset.master.conn.error ~= nil then
local error_msg = string.format('The connection to the master is not valid: %s',
replicaset.master.conn.error)
error(error_msg)
end
local space = replicaset.master.conn.space[space_name]

return space
Expand Down

0 comments on commit c80b0ac

Please sign in to comment.