25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-24 16:23:40 +01:00

Log failed SQL requests

This commit is contained in:
Evgeniy Khramtsov 2016-01-13 12:59:00 +03:00
parent 776fe8b32a
commit fd3e3a99c5

View File

@ -125,7 +125,7 @@ start_link(Host, StartInterval) ->
-spec sql_query(binary(), sql_query()) -> sql_query_result().
sql_query(Host, Query) ->
sql_call(Host, {sql_query, Query}).
check_error(sql_call(Host, {sql_query, Query}), Query).
%% SQL transaction based on a list of queries
%% This function automatically
@ -800,6 +800,12 @@ fsm_limit_opts() ->
_ -> []
end.
check_error({error, Why} = Err, Query) ->
?ERROR_MSG("SQL query '~s' failed: ~p", [Query, Why]),
Err;
check_error(Result, _Query) ->
Result.
opt_type(max_fsm_queue) ->
fun (N) when is_integer(N), N > 0 -> N end;
opt_type(odbc_database) -> fun iolist_to_binary/1;