# HG changeset patch # User Waqas Hussain # Date 1291922469 -18000 # Node ID f15b6ed967b7b3184fa91830457ca3e45b7ac95a # Parent bd5c6c333ee76b353daae9e699186a7845ccd542 util.datamanager: When failing to load a list file, and the file exists, log an error, and return nil, error. diff -r bd5c6c333ee7 -r f15b6ed967b7 util/datamanager.lua --- a/util/datamanager.lua Fri Dec 10 00:07:28 2010 +0500 +++ b/util/datamanager.lua Fri Dec 10 00:21:09 2010 +0500 @@ -204,8 +204,15 @@ 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});