aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndreas Köhler <andreas.koehler@1und1.de>2010-11-02 16:18:16 +0100
committerBadlop <badlop@process-one.net>2010-11-07 00:49:52 +0100
commitc4bc0e7252dd3e70830e45a3742a200e2c0d096e (patch)
tree0bc612a142f124543d7988537a998ee03e0c9d5d /src
parentTake care of xml:lang attribute in unauthenticated stanzas as well (diff)
Re-raise exceptions caught in gen_mod:start_module/3 (EJAB-1335)
Modules configured by the administrator normally should not be treated as optional, so a exception (error, exit, throw) to start them should not be caught and logged only. This patch re-raises a caught exception instead of ignoring the exception and inserting the module's opts on success. That way gen_mod:get_module_opt/4 should work while calling Module:start/2.
Diffstat (limited to '')
-rw-r--r--src/gen_mod.erl10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/gen_mod.erl b/src/gen_mod.erl
index e17927447..92a5628cb 100644
--- a/src/gen_mod.erl
+++ b/src/gen_mod.erl
@@ -66,13 +66,13 @@ start_module(Host, Module, Opts) ->
ets:insert(ejabberd_modules,
#ejabberd_module{module_host = {Module, Host},
opts = Opts}),
- case catch Module:start(Host, Opts) of
- {'EXIT', Reason} ->
+ try Module:start(Host, Opts)
+ catch Class:Reason ->
del_module_mnesia(Host, Module),
ets:delete(ejabberd_modules, {Module, Host}),
- ?ERROR_MSG("~p", [Reason]);
- _ ->
- ok
+ ?ERROR_MSG("Problem starting the module ~p for host ~p with options:~n ~p~n ~p: ~p",
+ [Module, Host, Opts, Class, Reason]),
+ erlang:raise(Class, Reason, erlang:get_stacktrace())
end.
%% @doc Stop the module in a host, and forget its configuration.