Appropriately abort pubsub transaction

This commit is contained in:
Evgeny Khramtsov 2019-07-29 21:44:30 +03:00
parent 630cfe26b7
commit 2cd930b7d5
1 changed files with 8 additions and 2 deletions

View File

@ -3806,9 +3806,15 @@ transaction(Host, Fun, Trans) ->
do_transaction(ServerHost, Fun, Trans, DBType) -> do_transaction(ServerHost, Fun, Trans, DBType) ->
F = fun() -> F = fun() ->
try Fun() try Fun()
catch ?EX_RULE(Class, Reason, St) -> catch ?EX_RULE(Class, Reason, St) when (DBType == mnesia andalso
Trans == transaction) orelse
DBType == sql ->
StackTrace = ?EX_STACK(St), StackTrace = ?EX_STACK(St),
mnesia:abort({exception, Class, Reason, StackTrace}) Ex = {exception, Class, Reason, StackTrace},
case DBType of
mnesia -> mnesia:abort(Ex);
sql -> ejabberd_sql:abort(Ex)
end
end end
end, end,
Res = case DBType of Res = case DBType of