Mercurial > prosody-modules
diff mod_unified_push/mod_unified_push.lua @ 6562:5da6fb562df9 default tip
mod_unified_push: Fix push error handling (fixes #2000)
Use the error object that send_iq() passes
as an argument to it's reject callback instead of attempting
and failing to do the parsing in the callback itself.
| author | kmq |
|---|---|
| date | Mon, 06 Jul 2026 14:23:57 +0200 |
| parents | b00638d74f46 |
| children |
line wrap: on
line diff
--- a/mod_unified_push/mod_unified_push.lua Mon Jun 08 22:42:05 2026 +0200 +++ b/mod_unified_push/mod_unified_push.lua Mon Jul 06 14:23:57 2026 +0200 @@ -182,16 +182,15 @@ return module:send_iq(push_iq):next(function () module:log("debug", "Push notification delivered [%s]", push_id); return 201; - end, function (error_event) - local e_type, e_cond, e_text = error_event.stanza:get_error(); - if e_cond == "item-not-found" or e_cond == "feature-not-implemented" then + end, function (err) + if err.condition == "item-not-found" or err.condition == "feature-not-implemented" then module:log("debug", "Push rejected [%s]", push_id); return 404; - elseif e_cond == "service-unavailable" or e_cond == "recipient-unavailable" then + elseif err.condition == "service-unavailable" or err.condition == "recipient-unavailable" then module:log("debug", "Recipient temporarily unavailable [%s]", push_id); return 503; end - module:log("warn", "Unexpected push error response: %s/%s/%s", e_type, e_cond, e_text); + module:log("warn", "Unexpected push error response: %s/%s/%s", err.type, err.condition, err.text); return 500; end); end
