If command crashes, return restuple with error and explanation (ejabberd-contrib #21)

This commit is contained in:
Badlop 2015-03-25 13:56:42 +01:00
parent 33c9f21171
commit d9ad26b4ec
1 changed files with 7 additions and 1 deletions

View 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()]}].