Changeset

4827:fe5303da99cb

mod_cloud_notify: Include extra error details if available
author Kim Alvefur <zash@zash.se>
date Sun, 19 Dec 2021 01:33:34 +0100
parents 4826:3a5fbb6c61b3
children 4828:56eba4bca28f
files mod_cloud_notify/mod_cloud_notify.lua
diffstat 1 files changed, 5 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/mod_cloud_notify/mod_cloud_notify.lua	Wed Dec 15 22:24:34 2021 +0100
+++ b/mod_cloud_notify/mod_cloud_notify.lua	Sun Dec 19 01:33:34 2021 +0100
@@ -74,7 +74,7 @@
 
 function handle_push_error(event)
 	local stanza = event.stanza;
-	local error_type, condition = stanza:get_error();
+	local error_type, condition, error_text = stanza:get_error();
 	local node = id2node[stanza.attr.id];
 	local identifier = id2identifier[stanza.attr.id];
 	if node == nil then return false; end		-- unknown stanza? Ignore for now!
@@ -86,8 +86,8 @@
 		if push_identifier == identifier then
 			if user_push_services[push_identifier] and user_push_services[push_identifier].jid == from and error_type ~= "wait" then
 				push_errors[push_identifier] = push_errors[push_identifier] + 1;
-				module:log("info", "Got error of type '%s' (%s) for identifier '%s': "
-					.."error count for this identifier is now at %s", error_type, condition, push_identifier,
+				module:log("info", "Got error <%s:%s:%s> for identifier '%s': "
+					.."error count for this identifier is now at %s", error_type, condition, error_text or "", push_identifier,
 					tostring(push_errors[push_identifier]));
 				if push_errors[push_identifier] >= max_push_errors then
 					module:log("warn", "Disabling push notifications for identifier '%s'", push_identifier);
@@ -112,8 +112,8 @@
 					id2identifier[stanza.attr.id] = nil;
 				end
 			elseif user_push_services[push_identifier] and user_push_services[push_identifier].jid == from and error_type == "wait" then
-				module:log("debug", "Got error of type '%s' (%s) for identifier '%s': "
-					.."NOT increasing error count for this identifier", error_type, condition, push_identifier);
+				module:log("debug", "Got error <%s:%s:%s> for identifier '%s': "
+					.."NOT increasing error count for this identifier", error_type, condition, error_text or "", push_identifier);
 			end
 		end
 	end