create-item: don't register item if failed to activate

Related to #128
This commit is contained in:
Julian Bouzas
2021-12-21 09:41:45 -05:00
committed by George Kiagiadakis
parent f3f063760c
commit c6445ed3db

View File

@@ -69,9 +69,13 @@ function addItem (node, item_type)
end
-- activate item
items[id]:activate (Features.ALL, function (item)
Log.info(item, "activated item for node " .. tostring(id))
item:register ()
items[id]:activate (Features.ALL, function (item, e)
if e then
Log.warning(item, "failed to activate item: " .. tostring(e));
else
Log.info(item, "activated item for node " .. tostring(id))
item:register ()
end
end)
end