# HG changeset patch # User Matthew Wild # Date 1534602395 -3600 # Node ID 76d593b35958abfa5b6f96257dfd3bd13a7490a0 # Parent 33ee40dc3e255b77112fa511a446aad211da3724 util.pubsub, pubsub.lib: Improve error on attempt to publish invalid item diff -r 33ee40dc3e25 -r 76d593b35958 plugins/mod_pubsub/pubsub.lib.lua --- a/plugins/mod_pubsub/pubsub.lib.lua Sat Aug 18 15:10:41 2018 +0100 +++ b/plugins/mod_pubsub/pubsub.lib.lua Sat Aug 18 15:26:35 2018 +0100 @@ -30,6 +30,7 @@ ["not-acceptable"] = { "modify", "not-acceptable" }; ["internal-server-error"] = { "wait", "internal-server-error" }; ["precondition-not-met"] = { "cancel", "conflict", nil, "precondition-not-met" }; + ["invalid-item"] = { "modify", "bad-request", "invalid item" }; }; local function pubsub_error_reply(stanza, error) local e = pubsub_errors[error]; diff -r 33ee40dc3e25 -r 76d593b35958 util/pubsub.lua --- a/util/pubsub.lua Sat Aug 18 15:10:41 2018 +0100 +++ b/util/pubsub.lua Sat Aug 18 15:26:35 2018 +0100 @@ -509,7 +509,7 @@ return false, "precondition-not-met"; end if not self.config.itemcheck(item) then - return nil, "internal-server-error"; + return nil, "invalid-item"; end local node_data = self.data[node]; local ok = node_data:set(id, item);