From 13fd316d82218961b88a4a3d96fa25f0ab41cc3d Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Fri, 13 Feb 2009 14:37:15 +0000 Subject: Report errors in the config file to the user --- prosody | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'prosody') diff --git a/prosody b/prosody index f63fc50d..197446e6 100755 --- a/prosody +++ b/prosody @@ -40,17 +40,25 @@ log = require "util.logger".init("general"); do -- TODO: Check for other formats when we add support for them -- Use lfs? Make a new conf/ dir? - local ok, err = config.load((CFG_CONFIGDIR or ".").."/prosody.cfg.lua"); + local ok, level, err = config.load((CFG_CONFIGDIR or ".").."/prosody.cfg.lua"); if not ok then print(""); print("**************************"); - print("Prosody was unable to find the configuration file."); - print("We looked for: "..(CFG_CONFIGDIR or ".").."/prosody.cfg.lua"); - print("A sample config file is included in the Prosody download called prosody.cfg.lua.dist"); - print("Copy or rename it to prosody.cfg.lua and edit as necessary."); + if level == "parser" then + print("A problem occured while reading the config file "..(CFG_CONFIGDIR or ".").."/prosody.cfg.lua"); + local err_line, err_message = tostring(err):match("%[string .-%]:(%d*): (.*)"); + print("Error"..(err_line and (" on line "..err_line) or "")..": "..(err_message or tostring(err))); + print(""); + elseif level == "file" then + print("Prosody was unable to find the configuration file."); + print("We looked for: "..(CFG_CONFIGDIR or ".").."/prosody.cfg.lua"); + print("A sample config file is included in the Prosody download called prosody.cfg.lua.dist"); + print("Copy or rename it to prosody.cfg.lua and edit as necessary."); + end print("More help on configuring Prosody can be found at http://prosody.im/doc/configure"); print("Good luck!"); print("**************************"); + print(""); os.exit(1); end end -- cgit v1.2.3