Skip to content

Commit c80b0ac

Browse files
committed
internal: master conn check for get space utils
Added validation of the connection to the `utils.get_space` method before receiving the space through the connection. Closes #331
1 parent 733528b commit c80b0ac

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

crud/common/utils.lua

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,12 @@ end
9797

9898
function utils.get_space(space_name, replicasets)
9999
local replicaset = select(2, next(replicasets))
100+
101+
if replicaset.master.conn.error ~= nil then
102+
local error_msg = string.format('The connection to the master is not valid: %s',
103+
replicaset.master.conn.error)
104+
error(error_msg)
105+
end
100106
local space = replicaset.master.conn.space[space_name]
101107

102108
return space

0 commit comments

Comments
 (0)