1
0
Fork 0
mirror of https://github.com/processone/ejabberd synced 2025-10-03 01:39:35 +02:00

Bubble up db errors in nodetree_tree_sql:set_node

This commit is contained in:
Paweł Chmielowski 2025-02-20 14:48:45 +01:00
parent 45dafbcdcc
commit 6bd4399aee

View file

@ -82,17 +82,22 @@ set_node(Record) when is_record(Record, pubsub_node) ->
" parent=%(Parent)s, plugin=%(Type)s "
"where nodeid=%(OldNidx)d")),
OldNidx;
_ ->
{error, not_found} ->
catch
ejabberd_sql:sql_query_t(
?SQL("insert into pubsub_node(host, node, parent, plugin) "
"values(%(H)s, %(Node)s, %(Parent)s, %(Type)s)")),
case nodeidx(Host, Node) of
{result, NewNidx} -> NewNidx;
_ -> none % this should not happen
end
{error, not_found} -> none; % this should not happen
{error, _} -> db_error
end;
{error, _} ->
db_error
end,
case Nidx of
db_error ->
{error, xmpp:err_internal_server_error(?T("Database failure"), ejabberd_option:language())};
none ->
Txt = ?T("Node index not found"),
{error, xmpp:err_internal_server_error(Txt, ejabberd_option:language())};