Comparison

util/error.lua @ 11090:33b6fbdcec88

util.error: Default error originator to stanza sender The @by attribute is primarily useful for errors caused by intermediate entities.
author Kim Alvefur <zash@zash.se>
date Sat, 26 Sep 2020 18:14:10 +0200
parent 11089:35d2260644d9
child 11091:4b4b5188492f
comparison
equal deleted inserted replaced
11089:35d2260644d9 11090:33b6fbdcec88
94 local function from_stanza(stanza, context) 94 local function from_stanza(stanza, context)
95 local error_type, condition, text = stanza:get_error(); 95 local error_type, condition, text = stanza:get_error();
96 local error_tag = stanza:get_child("error"); 96 local error_tag = stanza:get_child("error");
97 context = context or {}; 97 context = context or {};
98 context.stanza = stanza; 98 context.stanza = stanza;
99 context.by = error_tag.attr.by; 99 context.by = error_tag.attr.by or stanza.attr.from;
100
100 return setmetatable({ 101 return setmetatable({
101 type = error_type or "cancel"; 102 type = error_type or "cancel";
102 condition = condition or "undefined-condition"; 103 condition = condition or "undefined-condition";
103 text = text; 104 text = text;
104 105