Software /
code /
prosody
Comparison
util/datamanager.lua @ 8014:ff3787033abb
util.datamanager: Log where the error came from
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Tue, 28 Mar 2017 17:31:55 +0200 |
parent | 8013:72cfbe377326 |
child | 8092:0a1c0f1107d2 |
comparison
equal
deleted
inserted
replaced
8013:72cfbe377326 | 8014:ff3787033abb |
---|---|
238 return ok, msg, "write"; | 238 return ok, msg, "write"; |
239 end | 239 end |
240 | 240 |
241 ok, msg = f:close(); | 241 ok, msg = f:close(); |
242 if not ok then | 242 if not ok then |
243 return ok, msg; | 243 return ok, msg, "close"; |
244 end | 244 end |
245 | 245 |
246 return true, pos; | 246 return true, pos; |
247 end | 247 end |
248 | 248 |
250 if not data then return; end | 250 if not data then return; end |
251 if callback(username, host, datastore) == false then return true; end | 251 if callback(username, host, datastore) == false then return true; end |
252 -- save the datastore | 252 -- save the datastore |
253 | 253 |
254 data = "item(" .. serialize(data) .. ");\n"; | 254 data = "item(" .. serialize(data) .. ");\n"; |
255 local ok, msg = append(username, host, datastore, "list", data); | 255 local ok, msg, where = append(username, host, datastore, "list", data); |
256 if not ok then | 256 if not ok then |
257 log("error", "Unable to write to %s storage ('%s') for user: %s@%s", datastore, msg, username or "nil", host or "nil"); | 257 log("error", "Unable to write to %s storage ('%s' in %s) for user: %s@%s", |
258 datastore, msg, where, username or "nil", host or "nil"); | |
258 return ok, msg; | 259 return ok, msg; |
259 end | 260 end |
260 return true; | 261 return true; |
261 end | 262 end |
262 | 263 |