Mercurial > prosody-modules
diff mod_storage_xmlarchive/mod_storage_xmlarchive.lua @ 1726:160c35d2a5a2
mod_storage_xmlarchive: Improve logging of parse errors
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Mon, 11 May 2015 14:16:23 +0200 |
parents | 8c0fbc685364 |
children | 8f12afb633ec |
line wrap: on
line diff
--- a/mod_storage_xmlarchive/mod_storage_xmlarchive.lua Thu May 07 23:39:54 2015 +0200 +++ b/mod_storage_xmlarchive/mod_storage_xmlarchive.lua Mon May 11 14:16:23 2015 +0200 @@ -100,6 +100,7 @@ return function () if limit and count >= limit then xmlfile:close() return; end + local filename; for d = start_day, last_day, step do if d ~= start_day or not items then @@ -112,7 +113,8 @@ first_item, last_item = #items, 1; end local ferr; - xmlfile, ferr = io.open(dm.getpath(username .. "@" .. dates[d], module.host, self.store, "xml")); + filename = dm.getpath(username .. "@" .. dates[d], module.host, self.store, "xml"); + xmlfile, ferr = io.open(filename); if not xmlfile then module:log("error", "Error: %s", ferr); return; @@ -137,7 +139,7 @@ local data = xmlfile:read(item.length); local ok, err = stream:feed(data); if not ok then - module:log("warn", "Parse error: %s", err); + module:log("warn", "Parse error in %s at %d+%d: %s", filename, item.offset, item.length, err); end if result then local stanza = result;