]> granicus.if.org Git - ejabberd/commitdiff
Added clause so ejabberdctl number of arguments error report works with R15
authorBadlop <badlop@process-one.net>
Mon, 27 Aug 2012 14:38:52 +0000 (16:38 +0200)
committerBadlop <badlop@process-one.net>
Mon, 27 Aug 2012 14:38:52 +0000 (16:38 +0200)
src/ejabberd_ctl.erl

index ceb4c34d70705476cd8b2a4d9e62a1829ca57c84..01b07eafee78c53a2775f7c77a04d41ceec0af82 100644 (file)
@@ -292,7 +292,18 @@ call_command([CmdString | Args], Auth, AccessCommands) ->
                    Result = ejabberd_commands:execute_command(AccessCommands, Auth, Command,
                                                               ArgsFormatted),
                    format_result(Result, ResultFormat);
+               %% This case clause is for Erlang R14 and older
                {'EXIT', {function_clause,[{lists,zip,[A1, A2]} | _]}} ->
+                   {NumCompa, TextCompa} =
+                       case {length(A1), length(A2)} of
+                           {L1, L2} when L1 < L2 -> {L2-L1, "less argument"};
+                           {L1, L2} when L1 > L2 -> {L1-L2, "more argument"}
+                       end,
+                   {io_lib:format("Error: the command ~p requires ~p ~s.",
+                                  [CmdString, NumCompa, TextCompa]),
+                    wrong_command_arguments};
+               %% This case clause is for Erlang R15 and newer
+               {'EXIT', {function_clause,[{lists,zip,[A1, A2],_} | _]}} ->
                    {NumCompa, TextCompa} =
                        case {length(A1), length(A2)} of
                            {L1, L2} when L1 < L2 -> {L2-L1, "less argument"};