From c80b0acec6921b5ae96cf7d51dbd2d545e843c67 Mon Sep 17 00:00:00 2001 From: Ilya Grishnov Date: Wed, 28 Dec 2022 19:21:53 +0300 Subject: [PATCH] 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 --- crud/common/utils.lua | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/crud/common/utils.lua b/crud/common/utils.lua index 46f0f643..3a8478d1 100644 --- a/crud/common/utils.lua +++ b/crud/common/utils.lua @@ -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