changeset 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 e3e76e9693a1
children 3246d53ce0c3
files mod_mam/mod_mam.lua
diffstat 1 files changed, 9 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/mod_mam/mod_mam.lua	Tue Jan 05 19:19:43 2016 +0100
+++ b/mod_mam/mod_mam.lua	Sat Jan 09 14:18:07 2016 +0100
@@ -1,5 +1,5 @@
 -- XEP-0313: Message Archive Management for Prosody
--- Copyright (C) 2011-2014 Kim Alvefur
+-- Copyright (C) 2011-2016 Kim Alvefur
 --
 -- This file is MIT/X11 licensed.
 
@@ -36,12 +36,16 @@
 end
 
 local archive_store = "archive2";
-local archive = module:open_store(archive_store, "archive");
-if not archive or archive.name == "null" then
-	module:log("error", "Could not open archive storage");
+local archive = assert(module:open_store(archive_store, "archive"));
+if archive.name == "null" then
+	module:log("debug", "Attempt to open archive storage returned null driver");
+	module:log("error", "Unable to open archive storage, no archive capable storage driver enabled?");
+	module:log("info", "See https://prosody.im/doc/storage and https://prosody.im/doc/archiving for more information");
 	return;
 elseif not archive.find then
-	module:log("error", "mod_%s does not support archiving", archive._provided_by);
+	module:log("debug", "Attempt to open archive storage returned a valid driver but it does not seem to implement the storage API");
+	module:log("error", "mod_%s does not support archiving", archive._provided_by or archive.name and "storage_"..name.."(?)" or "<unknown>");
+	module:log("info", "See https://prosody.im/doc/storage and https://prosody.im/doc/archiving for more information");
 	return;
 end