aboutsummaryrefslogtreecommitdiffstats
path: root/util/stanza.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2020-09-26 18:12:18 +0200
committerKim Alvefur <zash@zash.se>2020-09-26 18:12:18 +0200
commit815ce25d10e49f4efa7b402c8d5b03a0f63474f1 (patch)
tree2515f16850c201f1fd077cd4fde322dc651f04aa /util/stanza.lua
parenta7c3fc20a079422cf597a5a20e88c6e58054de39 (diff)
downloadprosody-815ce25d10e49f4efa7b402c8d5b03a0f63474f1.tar.gz
prosody-815ce25d10e49f4efa7b402c8d5b03a0f63474f1.zip
util.stanza: Extract Application-Specific Condition from errors
API change
Diffstat (limited to 'util/stanza.lua')
-rw-r--r--util/stanza.lua14
1 files changed, 8 insertions, 6 deletions
diff --git a/util/stanza.lua b/util/stanza.lua
index 9bcf3747..94815346 100644
--- a/util/stanza.lua
+++ b/util/stanza.lua
@@ -349,11 +349,11 @@ function stanza_mt.get_text(t)
end
function stanza_mt.get_error(stanza)
- local error_type, condition, text;
+ local error_type, condition, text, extra_tag;
local error_tag = stanza:get_child("error");
if not error_tag then
- return nil, nil, nil;
+ return nil, nil, nil, nil;
end
error_type = error_tag.attr.type;
@@ -364,12 +364,14 @@ function stanza_mt.get_error(stanza)
elseif not condition then
condition = child.name;
end
- if condition and text then
- break;
- end
+ else
+ extra_tag = child;
+ end
+ if condition and text and extra_tag then
+ break;
end
end
- return error_type, condition or "undefined-condition", text;
+ return error_type, condition or "undefined-condition", text, extra_tag;
end
local function preserialize(stanza)