diff options
author | Badlop <badlop@process-one.net> | 2015-03-25 13:56:42 +0100 |
---|---|---|
committer | Badlop <badlop@process-one.net> | 2015-03-25 13:57:08 +0100 |
commit | d9ad26b4ec066a1062553a32555039131fd824f7 (patch) | |
tree | f9f5fcfc986ddf227a65744f9863802784465596 /src/ejabberd_commands.erl | |
parent | Return error when incoming message is blocked (diff) |
If command crashes, return restuple with error and explanation (ejabberd-contrib #21)
Diffstat (limited to 'src/ejabberd_commands.erl')
-rw-r--r-- | src/ejabberd_commands.erl | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/ejabberd_commands.erl b/src/ejabberd_commands.erl index c279f2d0f..a4f38e836 100644 --- a/src/ejabberd_commands.erl +++ b/src/ejabberd_commands.erl @@ -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()]}]. |