aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--plugins/mod_pubsub/pubsub.lib.lua7
-rw-r--r--util/pubsub.lua7
2 files changed, 5 insertions, 9 deletions
diff --git a/plugins/mod_pubsub/pubsub.lib.lua b/plugins/mod_pubsub/pubsub.lib.lua
index f2980c18..5a9be149 100644
--- a/plugins/mod_pubsub/pubsub.lib.lua
+++ b/plugins/mod_pubsub/pubsub.lib.lua
@@ -34,10 +34,11 @@ local pubsub_errors = errors.init("pubsub", xmlns_pubsub_errors, {
["persistent-items-unsupported"] = { "cancel", "feature-not-implemented", nil, "persistent-items" };
});
local function pubsub_error_reply(stanza, error, context)
- if type(error) == "table" and type(error.pubsub_condition) == "string" then
- error.extra = { namespace = xmlns_pubsub_errors; condition = error.pubsub_condition }
+ local err = pubsub_errors.wrap(error, context);
+ if error == "precondition-not-met" and type(context) == "table" and type(context.field) == "string" then
+ err.text = "Field does not match: " .. context.field;
end
- local reply = st.error_reply(stanza, pubsub_errors.wrap(error, context));
+ local reply = st.error_reply(stanza, err);
return reply;
end
_M.pubsub_error_reply = pubsub_error_reply;
diff --git a/util/pubsub.lua b/util/pubsub.lua
index ccde8b53..11ed4e1c 100644
--- a/util/pubsub.lua
+++ b/util/pubsub.lua
@@ -1,6 +1,5 @@
local events = require "prosody.util.events";
local cache = require "prosody.util.cache";
-local errors = require "prosody.util.error";
local service_mt = {};
@@ -562,11 +561,7 @@ function service:publish(node, actor, id, item, requested_config) --> ok, err
-- Check that node has the requested config before we publish
local ok, field = check_preconditions(node_obj.config, requested_config);
if not ok then
- local err = errors.new({
- type = "cancel", condition = "conflict", text = "Field does not match: "..field;
- });
- err.pubsub_condition = "precondition-not-met";
- return false, err;
+ return false, "precondition-not-met", { field = field };
end
end
if not self.config.itemcheck(item) then