mirror of
https://github.com/processone/ejabberd
synced 2025-10-03 09:49:18 +02:00
mod_http_api: Fix crash when module not enabled (for example, in CT tests)
This commit is contained in:
parent
3d2036db61
commit
ae238bc984
1 changed files with 6 additions and 1 deletions
|
@ -214,7 +214,12 @@ get_api_version([<<"v", String/binary>> | Tail], Host) ->
|
||||||
get_api_version([_Head | Tail], Host) ->
|
get_api_version([_Head | Tail], Host) ->
|
||||||
get_api_version(Tail, Host);
|
get_api_version(Tail, Host);
|
||||||
get_api_version([], Host) ->
|
get_api_version([], Host) ->
|
||||||
mod_http_api_opt:default_version(Host).
|
try mod_http_api_opt:default_version(Host)
|
||||||
|
catch error:{module_not_loaded, ?MODULE, Host} ->
|
||||||
|
?WARNING_MSG("Using module ~p for host ~s, but it isn't configured "
|
||||||
|
"in the configuration file", [?MODULE, Host]),
|
||||||
|
?DEFAULT_API_VERSION
|
||||||
|
end.
|
||||||
|
|
||||||
%% ----------------
|
%% ----------------
|
||||||
%% command handlers
|
%% command handlers
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue