Diff

util/error.lua @ 11092:bd13aa89262d

util.error: Collect Application-Specific Conditions from stanza errors
author Kim Alvefur <zash@zash.se>
date Sat, 26 Sep 2020 18:15:49 +0200
parent 11091:4b4b5188492f
child 11094:03fdf41fd948
line wrap: on
line diff
--- a/util/error.lua	Sat Sep 26 18:15:27 2020 +0200
+++ b/util/error.lua	Sat Sep 26 18:15:49 2020 +0200
@@ -92,7 +92,7 @@
 end
 
 local function from_stanza(stanza, context)
-	local error_type, condition, text = stanza:get_error();
+	local error_type, condition, text, extra_tag = stanza:get_error();
 	local error_tag = stanza:get_child("error");
 	context = context or {};
 	context.stanza = stanza;
@@ -102,8 +102,9 @@
 		type = error_type or "cancel";
 		condition = condition or "undefined-condition";
 		text = text;
-		extra = condition == "gone" and {
+		extra = (extra_tag or condition == "gone") and {
 			uri = error_tag:get_child_text("gone", "urn:ietf:params:xml:ns:xmpp-stanzas");
+			tag = extra_tag;
 		} or nil;
 
 		context = context;