]> granicus.if.org Git - ejabberd/commitdiff
If command crashes, return restuple with error and explanation (ejabberd-contrib...
authorBadlop <badlop@process-one.net>
Wed, 25 Mar 2015 12:56:42 +0000 (13:56 +0100)
committerBadlop <badlop@process-one.net>
Wed, 25 Mar 2015 12:57:08 +0000 (13:57 +0100)
src/ejabberd_commands.erl

index c279f2d0f6fab5454c520612cc1d610cc9662d2f..a4f38e83669690fe33923175e481d379c1cf2a27 100644 (file)
@@ -317,7 +317,13 @@ execute_command2(Command, Arguments) ->
     Module = Command#ejabberd_commands.module,
     Function = Command#ejabberd_commands.function,
     ?DEBUG("Executing command ~p:~p with Args=~p", [Module, Function, Arguments]),
-    apply(Module, Function, Arguments).
+    try apply(Module, Function, Arguments) of
+       Response ->
+           Response
+    catch
+       Problem ->
+           {error, Problem}
+    end.
 
 -spec get_tags_commands() -> [{string(), [string()]}].