mirror of
https://github.com/processone/ejabberd
synced 2025-10-03 17:59:31 +02:00
Bubble up db errors in nodetree_tree_sql:set_node
This commit is contained in:
parent
45dafbcdcc
commit
6bd4399aee
1 changed files with 8 additions and 3 deletions
|
@ -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())};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue