aboutsummaryrefslogtreecommitdiffstats
path: root/util/pubsub.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2024-10-29 14:56:02 +0100
committerKim Alvefur <zash@zash.se>2024-10-29 14:56:02 +0100
commitc175dc8265beac3ccb64781f0443a38a102bc1ff (patch)
treeb9d7a7fba4983ce11073350596c466b07f9c6a78 /util/pubsub.lua
parent73b512d3a6b988a89852cb7bf027daf8a90a9100 (diff)
downloadprosody-c175dc8265beac3ccb64781f0443a38a102bc1ff.tar.gz
prosody-c175dc8265beac3ccb64781f0443a38a102bc1ff.zip
mod_pubsub: Move precondition error wrangling out of util.pubsub
Removes dependency on util.error from util.pubsub which was only used for this one special case. Line count reduction! Would be even nicer if templating could be done by util.error itself.
Diffstat (limited to 'util/pubsub.lua')
-rw-r--r--util/pubsub.lua7
1 files changed, 1 insertions, 6 deletions
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