diff options
author | Badlop <badlop@process-one.net> | 2010-02-22 21:37:41 +0100 |
---|---|---|
committer | Badlop <badlop@process-one.net> | 2010-03-08 11:13:56 +0100 |
commit | f36ac2b8091a65b18c35c754c24c5e9c7cb1bed7 (patch) | |
tree | 0f0d5990edc6c6c44f9524e82fcb3fb4de3f1c29 | |
parent | Recompile the Guide (diff) |
Catch errors when exporting to PIEFXIS file (EJAB-1178)
-rw-r--r-- | src/ejabberd_piefxis.erl | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/ejabberd_piefxis.erl b/src/ejabberd_piefxis.erl index 2683f7738..4ed7e31dc 100644 --- a/src/ejabberd_piefxis.erl +++ b/src/ejabberd_piefxis.erl @@ -468,6 +468,7 @@ export_host(Dir, FnH, Host) -> Users = ejabberd_auth:get_vh_registered_users(Host), [export_user(Fd, Username, Host) || {Username, _Host} <- Users], + timer:sleep(500), % Delay to ensure ERROR_MSG are displayed in the shell print(Fd, make_piefxis_host_tail()), print(Fd, make_piefxis_xml_tail()), @@ -516,8 +517,14 @@ make_xinclude(Fn) -> %% @spec (Fd, Username::string(), Host::string()) -> ok %% @doc Extract user information and print it. export_user(Fd, Username, Host) -> - UserString = extract_user(Username, Host), - print(Fd, UserString). + try extract_user(Username, Host) of + UserString -> + print(Fd, UserString) + catch + E1:E2 -> + ?ERROR_MSG("The account ~s@~s is not exported because a problem " + "was found in it:~n~p: ~p", [Username, Host, E1, E2]) + end. %% @spec (Username::string(), Host::string()) -> string() extract_user(Username, Host) -> |