mirror of
https://github.com/processone/ejabberd.git
synced 2024-12-26 17:38:45 +01:00
Don't crash on most common gen_server:call errors
This commit is contained in:
parent
b662ec2a78
commit
6b8bc811ac
@ -580,8 +580,13 @@ sql_query_internal(#sql_query{} = Query) ->
|
|||||||
sqlite ->
|
sqlite ->
|
||||||
sqlite_sql_query(Query)
|
sqlite_sql_query(Query)
|
||||||
end
|
end
|
||||||
catch
|
catch exit:{timeout, _} ->
|
||||||
Class:Reason ->
|
{error, <<"timed out">>};
|
||||||
|
exit:{killed, _} ->
|
||||||
|
{error, <<"killed">>};
|
||||||
|
exit:{normal, _} ->
|
||||||
|
{error, <<"terminated unexpectedly">>};
|
||||||
|
Class:Reason ->
|
||||||
ST = erlang:get_stacktrace(),
|
ST = erlang:get_stacktrace(),
|
||||||
?ERROR_MSG("Internal error while processing SQL query: ~p",
|
?ERROR_MSG("Internal error while processing SQL query: ~p",
|
||||||
[{Class, Reason, ST}]),
|
[{Class, Reason, ST}]),
|
||||||
|
@ -682,6 +682,8 @@ inherit_session_state(#{user := U, server := S,
|
|||||||
{error, <<"Previous session PID is dead">>};
|
{error, <<"Previous session PID is dead">>};
|
||||||
exit:{normal, _} ->
|
exit:{normal, _} ->
|
||||||
{error, <<"Previous session PID has exited">>};
|
{error, <<"Previous session PID has exited">>};
|
||||||
|
exit:{killed, _} ->
|
||||||
|
{error, <<"Previous session PID has been killed">>};
|
||||||
exit:{timeout, _} ->
|
exit:{timeout, _} ->
|
||||||
ejabberd_sm:close_session(OldSID, U, S, R),
|
ejabberd_sm:close_session(OldSID, U, S, R),
|
||||||
ejabberd_c2s:stop(OldPID),
|
ejabberd_c2s:stop(OldPID),
|
||||||
|
Loading…
Reference in New Issue
Block a user