Changeset

2259:e0808be13d77

mod_cloud_notify: Abort and return error if unable to read storage to prevent loss of existing but unreachable data
author Kim Alvefur <zash@zash.se>
date Thu, 28 Jul 2016 12:36:59 +0200
parents 2258:3abc51faf945
children 2260:8cc8e964812b
files mod_cloud_notify/mod_cloud_notify.lua
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mod_cloud_notify/mod_cloud_notify.lua	Thu Jul 28 12:35:57 2016 +0200
+++ b/mod_cloud_notify/mod_cloud_notify.lua	Thu Jul 28 12:36:59 2016 +0200
@@ -42,8 +42,13 @@
 		-- Could be intentional
 		origin.log("debug", "No publish options in request");
 	end
-	local user_push_services = push_enabled:get(origin.username);
+	local user_push_services, rerr  = push_enabled:get(origin.username);
 	if not user_push_services then
+		if rerr then
+			module:log("warn", "Error reading push notification storage: %s", rerr);
+			origin.send(st.error_reply(stanza, "wait", "internal-server-error"));
+			return true;
+		end
 		user_push_services = {};
 	end
 	user_push_services[push_jid .. "<" .. (push_node or "")] = {