Provide a suggestion when unknown request handler is detected

This commit is contained in:
Evgeny Khramtsov 2019-04-30 10:31:03 +03:00
parent 11e963aa78
commit 268750e3b7
1 changed files with 5 additions and 2 deletions

View File

@ -971,10 +971,13 @@ prepare_request_module(Mod) when is_atom(Mod) ->
Mod; Mod;
Err -> Err ->
?ERROR_MSG( ?ERROR_MSG(
"Failed to load request handler ~s: " "Failed to load request handler ~s, "
"did you mean ~s? Hint: "
"make sure there is no typo and file ~s.beam " "make sure there is no typo and file ~s.beam "
"exists inside either ~s or ~s directory", "exists inside either ~s or ~s directory",
[Mod, Mod, [Mod,
misc:best_match(Mod, ejabberd_config:get_modules()),
Mod,
filename:dirname(code:which(?MODULE)), filename:dirname(code:which(?MODULE)),
ext_mod:modules_dir()]), ext_mod:modules_dir()]),
erlang:error(Err) erlang:error(Err)