From d6a69dbca563c984fbc542504d3adc4ad77fb12b Mon Sep 17 00:00:00 2001 From: Badlop Date: Fri, 15 Oct 2010 13:11:14 +0200 Subject: [PATCH] Fix errors detected by Dialyzer --- src/ejabberd_logger_h.erl | 2 +- src/ejabberd_piefxis.erl | 9 +++++---- src/ejabberd_s2s_out.erl | 2 +- src/web/ejabberd_web_admin.erl | 8 +++++--- 4 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/ejabberd_logger_h.erl b/src/ejabberd_logger_h.erl index 45c7fa9d2..56a29bcff 100644 --- a/src/ejabberd_logger_h.erl +++ b/src/ejabberd_logger_h.erl @@ -162,7 +162,7 @@ write_event(Fd, {Time, {warning_msg, _GL, {Pid, Format, Args}}}) -> file:write(Fd, io_lib:format(T ++ S, [])); _ -> F = add_node("ERROR: ~p - ~p~n", Pid), - file:write(Fd, io:format(T ++ F, [Format,Args])) + file:write(Fd, io_lib:format(T ++ F, [Format,Args])) end; write_event(_, _) -> ok. diff --git a/src/ejabberd_piefxis.erl b/src/ejabberd_piefxis.erl index cd56fc270..82cda1e2b 100644 --- a/src/ejabberd_piefxis.erl +++ b/src/ejabberd_piefxis.erl @@ -117,8 +117,8 @@ process_elements(Elements,State) -> process_element(El=#xmlel{name=user, ns=_XMLNS}, State=#parsing_state{host=Host}) -> case add_user(El,Host) of - {error, _Other} -> error; - _ -> ok + ok -> ok; + {error, _Other} -> error end, State; @@ -163,7 +163,7 @@ add_user(El, Domain) -> add_user(El, Domain, User, Password). %% @spec (El::xmlel(), Domain::string(), User::string(), Password::string()) -%% -> ok | {atomic, exists} | {error, not_allowed} +%% -> ok | {error, ErrorText::string()} %% @doc Add a new user to the database. %% If user already exists, it will be only updated. add_user(El, Domain, User, Password) -> @@ -185,7 +185,8 @@ add_user(El, Domain, User, Password) -> end, El); {error, Other} -> - ?ERROR_MSG("Error adding user ~s@~s: ~p~n", [User, Domain, Other]) + ?ERROR_MSG("Error adding user ~s@~s: ~p~n", [User, Domain, Other]), + {error, Other} end. %% @spec (User::string(), Password::string(), Domain::string()) diff --git a/src/ejabberd_s2s_out.erl b/src/ejabberd_s2s_out.erl index 7e686cce5..09cfce54e 100644 --- a/src/ejabberd_s2s_out.erl +++ b/src/ejabberd_s2s_out.erl @@ -859,7 +859,7 @@ terminate(Reason, StateName, StateData) -> false -> ok; Key -> - ejabberd_s2s:remove_connectio + ejabberd_s2s:remove_connection ({StateData#state.myname, StateData#state.server}, self(), Key) end, %% bounce queue manage by process and Erlang message queue diff --git a/src/web/ejabberd_web_admin.erl b/src/web/ejabberd_web_admin.erl index cfbdbe746..d92f54efa 100644 --- a/src/web/ejabberd_web_admin.erl +++ b/src/web/ejabberd_web_admin.erl @@ -2539,7 +2539,7 @@ get_node(global, Node, ["update"], Query, Lang) -> [?XC('h1', ?T("Update ") ++ atom_to_list(Node))] ++ case Res of ok -> [?XREST("Submitted")]; - error -> [?XREST("Bad format")]; + {error, ErrorText} -> [?XREST("Error: " ++ ErrorText)]; nothing -> [] end ++ [?XAE('form', [?XMLATTR('action', <<>>), ?XMLATTR('method', <<"post">>)], @@ -2922,9 +2922,11 @@ node_update_parse_query(Node, Query) -> {ok, _} -> ok; {error, Error} -> - ?ERROR_MSG("~p~n", [Error]); + ?ERROR_MSG("~p~n", [Error]), + {error, io_lib:format("~p", [Error])}; {badrpc, Error} -> - ?ERROR_MSG("~p~n", [Error]) + ?ERROR_MSG("Bad RPC: ~p~n", [Error]), + {error, "Bad RPC: " ++ io_lib:format("~p", [Error])} end; _ -> nothing