From ff6891cdd087ee65e3fd9c8b8ca15ecb50ff1794 Mon Sep 17 00:00:00 2001 From: Badlop Date: Fri, 24 Oct 2008 22:16:17 +0000 Subject: [PATCH] * src/translate.erl: When a translation file can't be loaded, show detailed error message SVN Revision: 1669 --- ChangeLog | 3 +++ src/translate.erl | 10 +++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index f5e2a3853..b6812ccfd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2008-10-25 Badlop + * src/translate.erl: When a translation file can't be loaded, show + detailed error message + * src/ejabberd_ctl.erl: If ejabberd didn't start correctly: 'ejabberdctl status' suggests to look in log files; any other ejabberdctl command shows 'status'. diff --git a/src/translate.erl b/src/translate.erl index eddea35e3..0a7d6029a 100644 --- a/src/translate.erl +++ b/src/translate.erl @@ -89,8 +89,16 @@ load_file(Lang, File) -> ets:insert(translations, {{Lang, Orig}, Trans1}) end, Terms); + %% Code copied from ejabberd_config.erl + {error, {_LineNumber, erl_parse, _ParseMessage} = Reason} -> + ExitText = lists:flatten(File ++ " approximately in the line " + ++ file:format_error(Reason)), + ?ERROR_MSG("Problem loading translation file ~n~s", [ExitText]), + exit(ExitText); {error, Reason} -> - exit(file:format_error(Reason)) + ExitText = lists:flatten(File ++ ": " ++ file:format_error(Reason)), + ?ERROR_MSG("Problem loading translation file ~n~s", [ExitText]), + exit(ExitText) end. translate(Lang, Msg) ->