changeset 2031:f21147d56bc4

mod_mam_muc: Yell loudly when archive store can't be opened
author Kim Alvefur <zash@zash.se>
date Fri, 22 Jan 2016 16:05:22 +0100
parents 66156e4d5274
children 6645838c6475
files mod_mam_muc/mod_mam_muc.lua
diffstat 1 files changed, 10 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/mod_mam_muc/mod_mam_muc.lua	Fri Jan 22 16:04:32 2016 +0100
+++ b/mod_mam_muc/mod_mam_muc.lua	Fri Jan 22 16:05:22 2016 +0100
@@ -50,12 +50,16 @@
 
 local archive_store = "muc_log";
 local archive = module:open_store(archive_store, "archive");
-if not archive or archive.name == "null" then
-	module:log("error", "Could not open archive storage");
-	return
-elseif not archive.find then
-	module:log("error", "mod_%s does not support archiving, switch to mod_storage_sql2", archive._provided_by);
-	return
+
+if archive.name == "null" or not archive.find then
+	if not archive.find then
+		module:log("error", "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_"..archive.name.."(?)" or "<unknown>");
+	else
+		module:log("error", "Attempt to open archive storage returned null driver");
+	end
+	module:log("info", "See https://prosody.im/doc/storage and https://prosody.im/doc/archiving for more information");
+	return false;
 end
 
 local function logging_enabled(room)