aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2020-09-27 00:17:48 +0200
committerKim Alvefur <zash@zash.se>2020-09-27 00:17:48 +0200
commit60a6ee0d30769c9066fae19b7db7dbf92ea777b7 (patch)
treeef14f985403110de5daeedea63675099178e297e
parent487f96c2f1700d17e5ed7623183a26a5345a3537 (diff)
downloadprosody-60a6ee0d30769c9066fae19b7db7dbf92ea777b7.tar.gz
prosody-60a6ee0d30769c9066fae19b7db7dbf92ea777b7.zip
util.error: Pass converted stanza errors throguh new()
In order to benefit from common processing
-rw-r--r--util/error.lua9
1 files changed, 3 insertions, 6 deletions
diff --git a/util/error.lua b/util/error.lua
index 92567248..fd6deb80 100644
--- a/util/error.lua
+++ b/util/error.lua
@@ -91,14 +91,14 @@ local function coerce(ok, err, ...)
return ok, new_err, ...;
end
-local function from_stanza(stanza, context)
+local function from_stanza(stanza, context, source)
local error_type, condition, text, extra_tag = stanza:get_error();
local error_tag = stanza:get_child("error");
context = context or {};
context.stanza = stanza;
context.by = error_tag.attr.by or stanza.attr.from;
- return setmetatable({
+ return new({
type = error_type or "cancel";
condition = condition or "undefined-condition";
text = text;
@@ -106,10 +106,7 @@ local function from_stanza(stanza, context)
uri = error_tag:get_child_text("gone", "urn:ietf:params:xml:ns:xmpp-stanzas");
tag = extra_tag;
} or nil;
-
- context = context;
-
- }, error_mt);
+ }, context, nil, source);
end
return {