mirror of
https://github.com/processone/ejabberd
synced 2025-10-03 09:49:18 +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 "
|
" parent=%(Parent)s, plugin=%(Type)s "
|
||||||
"where nodeid=%(OldNidx)d")),
|
"where nodeid=%(OldNidx)d")),
|
||||||
OldNidx;
|
OldNidx;
|
||||||
_ ->
|
{error, not_found} ->
|
||||||
catch
|
catch
|
||||||
ejabberd_sql:sql_query_t(
|
ejabberd_sql:sql_query_t(
|
||||||
?SQL("insert into pubsub_node(host, node, parent, plugin) "
|
?SQL("insert into pubsub_node(host, node, parent, plugin) "
|
||||||
"values(%(H)s, %(Node)s, %(Parent)s, %(Type)s)")),
|
"values(%(H)s, %(Node)s, %(Parent)s, %(Type)s)")),
|
||||||
case nodeidx(Host, Node) of
|
case nodeidx(Host, Node) of
|
||||||
{result, NewNidx} -> NewNidx;
|
{result, NewNidx} -> NewNidx;
|
||||||
_ -> none % this should not happen
|
{error, not_found} -> none; % this should not happen
|
||||||
end
|
{error, _} -> db_error
|
||||||
|
end;
|
||||||
|
{error, _} ->
|
||||||
|
db_error
|
||||||
end,
|
end,
|
||||||
case Nidx of
|
case Nidx of
|
||||||
|
db_error ->
|
||||||
|
{error, xmpp:err_internal_server_error(?T("Database failure"), ejabberd_option:language())};
|
||||||
none ->
|
none ->
|
||||||
Txt = ?T("Node index not found"),
|
Txt = ?T("Node index not found"),
|
||||||
{error, xmpp:err_internal_server_error(Txt, ejabberd_option:language())};
|
{error, xmpp:err_internal_server_error(Txt, ejabberd_option:language())};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue