aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2008-11-29 03:26:46 +0000
committerMatthew Wild <mwild1@gmail.com>2008-11-29 03:26:46 +0000
commit5b8969b8d9a926294b0f09b3f835ae994d58d012 (patch)
treec6a47ccd974378d0b28c1aa29125056ca1502389
parent46d4eaa6188ebfd25f37d9f114a65dbdbfa0a3e3 (diff)
downloadprosody-5b8969b8d9a926294b0f09b3f835ae994d58d012.tar.gz
prosody-5b8969b8d9a926294b0f09b3f835ae994d58d012.zip
Fix for configmanager when config file can't be found
-rw-r--r--core/configmanager.lua10
1 files changed, 7 insertions, 3 deletions
diff --git a/core/configmanager.lua b/core/configmanager.lua
index 5f5648b9..a4a24fad 100644
--- a/core/configmanager.lua
+++ b/core/configmanager.lua
@@ -2,6 +2,7 @@
local _G = _G;
local setmetatable, loadfile, pcall, rawget, rawset, io =
setmetatable, loadfile, pcall, rawget, rawset, io;
+
module "configmanager"
local parsers = {};
@@ -52,18 +53,21 @@ end
function load(filename, format)
format = format or filename:match("%w+$");
+
if parsers[format] and parsers[format].load then
- local f = io.open(filename);
+ local f, err = io.open(filename);
if f then
local ok, err = parsers[format].load(f:read("*a"));
f:close();
return ok, err;
end
+ return f, err;
end
+
if not format then
return nil, "no parser specified";
else
- return false, "no parser";
+ return nil, "no parser for "..(format);
end
end
@@ -118,4 +122,4 @@ do
end
-return _M; \ No newline at end of file
+return _M;