Software / code / prosody
Comparison
util/datamanager.lua @ 3723:72a917d910a4
util.datamanager: Return an error string when pcall fails on a loaded list file.
| author | Waqas Hussain <waqas20@gmail.com> |
|---|---|
| date | Fri, 10 Dec 2010 00:23:47 +0500 |
| parent | 3722:f15b6ed967b7 |
| child | 4093:36555949bd16 |
comparison
equal
deleted
inserted
replaced
| 3722:f15b6ed967b7 | 3723:72a917d910a4 |
|---|---|
| 217 local items = {}; | 217 local items = {}; |
| 218 setfenv(data, {item = function(i) t_insert(items, i); end}); | 218 setfenv(data, {item = function(i) t_insert(items, i); end}); |
| 219 local success, ret = pcall(data); | 219 local success, ret = pcall(data); |
| 220 if not success then | 220 if not success then |
| 221 log("error", "Unable to load "..datastore.." storage ('"..ret.."') for user: "..(username or "nil").."@"..(host or "nil")); | 221 log("error", "Unable to load "..datastore.." storage ('"..ret.."') for user: "..(username or "nil").."@"..(host or "nil")); |
| 222 return nil; | 222 return nil, "Error reading storage"; |
| 223 end | 223 end |
| 224 return items; | 224 return items; |
| 225 end | 225 end |
| 226 | 226 |
| 227 return _M; | 227 return _M; |