Comparison

util/stanza.lua @ 11083:4d12a6785531

util.stanza: Support getting 'by' from util.error object
author Kim Alvefur <zash@zash.se>
date Sat, 26 Sep 2020 17:26:31 +0200
parent 11082:c26599a78fae
child 11084:5e09a3389adb
comparison
equal deleted inserted replaced
11082:c26599a78fae 11083:4d12a6785531
454 error("bad argument to error_reply: got stanza of type error which must not be replied to"); 454 error("bad argument to error_reply: got stanza of type error which must not be replied to");
455 end 455 end
456 local t = reply(orig); 456 local t = reply(orig);
457 t.attr.type = "error"; 457 t.attr.type = "error";
458 if type(error_type) == "table" then -- an util.error or similar object 458 if type(error_type) == "table" then -- an util.error or similar object
459 if type(error_type.extra) == "table" then
460 if type(error_type.extra.by) == "string" then error_by = error_type.extra.by; end
461 end
459 error_type, condition, error_message = error_type.type, error_type.condition, error_type.text; 462 error_type, condition, error_message = error_type.type, error_type.condition, error_type.text;
460 end 463 end
461 if t.attr.from == error_by then 464 if t.attr.from == error_by then
462 error_by = nil; 465 error_by = nil;
463 end 466 end