Changeset

3871:e5d08bb58155

mod_rest: Map the error@by attribute
author Kim Alvefur <zash@zash.se>
date Sat, 01 Feb 2020 00:38:10 +0100
parents 3870:3261a82884bb
children 3872:513a8a7fab41
files mod_rest/jsonmap.lib.lua
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
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;