Software /
code /
prosody
Diff
util/stanza.lua @ 11088:1f84d0e4d0c4
util.stanza: Extract Application-Specific Condition from errors
API change
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sat, 26 Sep 2020 18:12:18 +0200 |
parent | 11086:2846b6226a8e |
child | 11206:f051394762ff |
line wrap: on
line diff
--- a/util/stanza.lua Sat Sep 26 19:00:17 2020 +0200 +++ b/util/stanza.lua Sat Sep 26 18:12:18 2020 +0200 @@ -349,11 +349,11 @@ 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 @@ 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)