scripts: add error code argument to sendClientError helper
And update all users accordingly. This will allow the following commit to use the helper with a different error code.
This commit is contained in:
@@ -314,7 +314,7 @@ function lutils.haveAvailableRoutes (si_props)
|
|||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
function lutils.sendClientError (event, node, message)
|
function lutils.sendClientError (event, node, code, message)
|
||||||
local source = event:get_source ()
|
local source = event:get_source ()
|
||||||
local client_id = node.properties ["client.id"]
|
local client_id = node.properties ["client.id"]
|
||||||
if client_id then
|
if client_id then
|
||||||
@@ -323,7 +323,7 @@ function lutils.sendClientError (event, node, message)
|
|||||||
Constraint { "bound-id", "=", client_id, type = "gobject" }
|
Constraint { "bound-id", "=", client_id, type = "gobject" }
|
||||||
}
|
}
|
||||||
if client then
|
if client then
|
||||||
client:send_error (node ["bound-id"], -2, message)
|
client:send_error (node ["bound-id"], code, message)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@@ -118,7 +118,7 @@ SimpleEventHook {
|
|||||||
local linger = cutils.parseBool (si_props ["node.linger"])
|
local linger = cutils.parseBool (si_props ["node.linger"])
|
||||||
if not linger then
|
if not linger then
|
||||||
local node = si:get_associated_proxy ("node")
|
local node = si:get_associated_proxy ("node")
|
||||||
lutils.sendClientError (event, node, "defined target not found")
|
lutils.sendClientError (event, node, -2, "defined target not found")
|
||||||
node:request_destroy ()
|
node:request_destroy ()
|
||||||
log:info(si, "... destroyed node as defined target was not found")
|
log:info(si, "... destroyed node as defined target was not found")
|
||||||
else
|
else
|
||||||
|
@@ -79,7 +79,7 @@ SimpleEventHook {
|
|||||||
local linger = cutils.parseBool (si_props ["node.linger"])
|
local linger = cutils.parseBool (si_props ["node.linger"])
|
||||||
if not linger then
|
if not linger then
|
||||||
local node = si:get_associated_proxy ("node")
|
local node = si:get_associated_proxy ("node")
|
||||||
lutils.sendClientError (event, node, "smart filter defined target not found")
|
lutils.sendClientError (event, node, -2, "smart filter defined target not found")
|
||||||
node:request_destroy ()
|
node:request_destroy ()
|
||||||
log:info(si, "... destroyed node as smart filter defined target was not found")
|
log:info(si, "... destroyed node as smart filter defined target was not found")
|
||||||
else
|
else
|
||||||
|
@@ -111,7 +111,7 @@ SimpleEventHook {
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
lutils.sendClientError (event, node,
|
lutils.sendClientError (event, node, -2,
|
||||||
reconnect and "no target node available" or "target not found")
|
reconnect and "no target node available" or "target not found")
|
||||||
|
|
||||||
if not reconnect then
|
if not reconnect then
|
||||||
|
Reference in New Issue
Block a user