mirror of
https://github.com/processone/ejabberd
synced 2025-10-03 09:49:18 +02:00
mod_private: Improve exception handling
Properly isolate the code that should be subject to exception handling.
This commit is contained in:
parent
e134d7f0b4
commit
76baf58d5d
1 changed files with 9 additions and 7 deletions
|
@ -447,13 +447,15 @@ pubsub_delete_item(_, _, _, _, _) ->
|
|||
|
||||
-spec pubsub_item_to_storage_bookmark(#pubsub_item{}) -> {true, bookmark_conference()} | false.
|
||||
pubsub_item_to_storage_bookmark(#pubsub_item{itemid = {Id, _}, payload = [#xmlel{} = B | _]}) ->
|
||||
try
|
||||
#pep_bookmarks_conference{name = Name, autojoin = AutoJoin, nick = Nick,
|
||||
password = Password} = xmpp:decode(B),
|
||||
#jid{} = Jid = jid:decode(Id),
|
||||
try {xmpp:decode(B), jid:decode(Id)} of
|
||||
{#pep_bookmarks_conference{name = Name, autojoin = AutoJoin,
|
||||
nick = Nick, password = Password},
|
||||
#jid{} = Jid} ->
|
||||
{true, #bookmark_conference{jid = Jid, name = Name,
|
||||
autojoin = AutoJoin, nick = Nick,
|
||||
password = Password}}
|
||||
password = Password}};
|
||||
{_, _} ->
|
||||
false
|
||||
catch
|
||||
_:{xmpp_codec, Why} ->
|
||||
?DEBUG("Failed to decode bookmark element (~ts): ~ts",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue