Diff

mod_rest/jsonmap.lib.lua @ 3871:e5d08bb58155

mod_rest: Map the error@by attribute
author Kim Alvefur <zash@zash.se>
date Sat, 01 Feb 2020 00:38:10 +0100
parent 3870:3261a82884bb
child 3875:93f71ab6cb00
line wrap: on
line diff
--- a/mod_rest/jsonmap.lib.lua	Wed Jan 29 21:44:00 2020 +0100
+++ b/mod_rest/jsonmap.lib.lua	Sat Feb 01 00:38:10 2020 +0100
@@ -203,11 +203,13 @@
 	end
 
 	if t.type == "error" then
+		local error = s:get_child("error");
 		local err_typ, err_condition, err_text = s:get_error();
 		t.error = {
 			type = err_typ,
 			condition = err_condition,
-			text = err_text
+			text = err_text,
+			by = error.attr.by,
 		};
 		return t;
 	end
@@ -281,7 +283,7 @@
 	end
 
 	if type(t.error) == "table" then
-		return st.error_reply(st.reply(s), str(t.error.type), str(t.error.condition), str(t.error.text));
+		return st.error_reply(st.reply(s), str(t.error.type), str(t.error.condition), str(t.error.text), str(t.error.by));
 	elseif t.type == "error" then
 		s:text_tag("error", t.body, { code = t.error_code and tostring(t.error_code) });
 		return s;