Mercurial > prosody-modules
comparison mod_mam/mod_mam.lua @ 2000:b5adfe72709b
mod_mam: Improve error messages when failed to open storage
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sat, 09 Jan 2016 14:18:07 +0100 |
parents | ca33cca2e028 |
children | 3246d53ce0c3 |
comparison
equal
deleted
inserted
replaced
1999:e3e76e9693a1 | 2000:b5adfe72709b |
---|---|
1 -- XEP-0313: Message Archive Management for Prosody | 1 -- XEP-0313: Message Archive Management for Prosody |
2 -- Copyright (C) 2011-2014 Kim Alvefur | 2 -- Copyright (C) 2011-2016 Kim Alvefur |
3 -- | 3 -- |
4 -- This file is MIT/X11 licensed. | 4 -- This file is MIT/X11 licensed. |
5 | 5 |
6 local xmlns_mam = "urn:xmpp:mam:0"; | 6 local xmlns_mam = "urn:xmpp:mam:0"; |
7 local xmlns_delay = "urn:xmpp:delay"; | 7 local xmlns_delay = "urn:xmpp:delay"; |
34 if global_default_policy ~= "roster" then | 34 if global_default_policy ~= "roster" then |
35 global_default_policy = module:get_option_boolean("default_archive_policy", global_default_policy); | 35 global_default_policy = module:get_option_boolean("default_archive_policy", global_default_policy); |
36 end | 36 end |
37 | 37 |
38 local archive_store = "archive2"; | 38 local archive_store = "archive2"; |
39 local archive = module:open_store(archive_store, "archive"); | 39 local archive = assert(module:open_store(archive_store, "archive")); |
40 if not archive or archive.name == "null" then | 40 if archive.name == "null" then |
41 module:log("error", "Could not open archive storage"); | 41 module:log("debug", "Attempt to open archive storage returned null driver"); |
42 module:log("error", "Unable to open archive storage, no archive capable storage driver enabled?"); | |
43 module:log("info", "See https://prosody.im/doc/storage and https://prosody.im/doc/archiving for more information"); | |
42 return; | 44 return; |
43 elseif not archive.find then | 45 elseif not archive.find then |
44 module:log("error", "mod_%s does not support archiving", archive._provided_by); | 46 module:log("debug", "Attempt to open archive storage returned a valid driver but it does not seem to implement the storage API"); |
47 module:log("error", "mod_%s does not support archiving", archive._provided_by or archive.name and "storage_"..name.."(?)" or "<unknown>"); | |
48 module:log("info", "See https://prosody.im/doc/storage and https://prosody.im/doc/archiving for more information"); | |
45 return; | 49 return; |
46 end | 50 end |
47 | 51 |
48 -- Handle prefs. | 52 -- Handle prefs. |
49 module:hook("iq/self/"..xmlns_mam..":prefs", function(event) | 53 module:hook("iq/self/"..xmlns_mam..":prefs", function(event) |