Diff

util/error.lua @ 11089:35d2260644d9

util.error: Extract error originator from stanza errors
author Kim Alvefur <zash@zash.se>
date Sat, 26 Sep 2020 18:13:27 +0200
parent 11081:0b68697450c5
child 11090:33b6fbdcec88
line wrap: on
line diff
--- a/util/error.lua	Sat Sep 26 18:12:18 2020 +0200
+++ b/util/error.lua	Sat Sep 26 18:13:27 2020 +0200
@@ -93,12 +93,17 @@
 
 local function from_stanza(stanza, context)
 	local error_type, condition, text = stanza:get_error();
+	local error_tag = stanza:get_child("error");
+	context = context or {};
+	context.stanza = stanza;
+	context.by = error_tag.attr.by;
 	return setmetatable({
 		type = error_type or "cancel";
 		condition = condition or "undefined-condition";
 		text = text;
 
-		context = context or { stanza = stanza };
+		context = context;
+
 	}, error_mt);
 end