aboutsummaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2019-12-14 22:47:41 +0100
committerKim Alvefur <zash@zash.se>2019-12-14 22:47:41 +0100
commit4e34c40ece0eb19f85720d63b1b0372f59e5616d (patch)
treee593facca294a596630c76644be654e8d02f56de /util
parent71d99b65fa50afebb0241199d4000a8a7c50e1d1 (diff)
downloadprosody-4e34c40ece0eb19f85720d63b1b0372f59e5616d.tar.gz
prosody-4e34c40ece0eb19f85720d63b1b0372f59e5616d.zip
util.stanza: Accept util.error object to error_reply
If we're moving towards util.error as the standard error container then this makes sense. This may allow for future extensibility without needing a lot of optional arguments.
Diffstat (limited to 'util')
-rw-r--r--util/stanza.lua3
1 files changed, 3 insertions, 0 deletions
diff --git a/util/stanza.lua b/util/stanza.lua
index 8e46f90f..f5cd5668 100644
--- a/util/stanza.lua
+++ b/util/stanza.lua
@@ -458,6 +458,9 @@ local function error_reply(orig, error_type, condition, error_message, error_by)
if t.attr.from == error_by then
error_by = nil;
end
+ if type(error_type) == "table" then -- an util.error or similar object
+ error_type, condition, error_message = error_type.type, error_type.condition, error_type.text;
+ end
t:tag("error", {type = error_type, by = error_by}) --COMPAT: Some day xmlns:stanzas goes here
:tag(condition, xmpp_stanzas_attr):up();
if error_message then t:text_tag("text", error_message, xmpp_stanzas_attr); end