diff options
author | Waqas Hussain <waqas20@gmail.com> | 2010-12-10 00:21:09 +0500 |
---|---|---|
committer | Waqas Hussain <waqas20@gmail.com> | 2010-12-10 00:21:09 +0500 |
commit | 899dfc626624520de7b794137d245fc7717e66ed (patch) | |
tree | 4f24f6610a67fb965c12bcf7c4bb7857548e51c1 /util/datamanager.lua | |
parent | c5118e930d832d622af2688c6678aa4f8ba670a5 (diff) | |
download | prosody-899dfc626624520de7b794137d245fc7717e66ed.tar.gz prosody-899dfc626624520de7b794137d245fc7717e66ed.zip |
util.datamanager: When failing to load a list file, and the file exists, log an error, and return nil, error.
Diffstat (limited to 'util/datamanager.lua')
-rw-r--r-- | util/datamanager.lua | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/util/datamanager.lua b/util/datamanager.lua index 57cd2594..dfb74a63 100644 --- a/util/datamanager.lua +++ b/util/datamanager.lua @@ -204,8 +204,15 @@ end function list_load(username, host, datastore) local data, ret = loadfile(getpath(username, host, datastore, "list")); if not data then - log("debug", "Failed to load "..datastore.." storage ('"..ret.."') for user: "..(username or "nil").."@"..(host or "nil")); - return nil; + local mode = lfs.attributes(getpath(username, host, datastore, "list"), "mode"); + if not mode then + log("debug", "Failed to load "..datastore.." storage ('"..ret.."') for user: "..(username or "nil").."@"..(host or "nil")); + return nil; + else -- file exists, but can't be read + -- TODO more detailed error checking and logging? + log("error", "Failed to load "..datastore.." storage ('"..ret.."') for user: "..(username or "nil").."@"..(host or "nil")); + return nil, "Error reading storage"; + end end local items = {}; setfenv(data, {item = function(i) t_insert(items, i); end}); |