Comparison

util/stanza.lua @ 12140:1a4c61253932

util.stanza: Remove dead code These cases are caught by `check_text(v, ..)` above. Those errors do not contain the attribute however, which would have been nice.
author Kim Alvefur <zash@zash.se>
date Fri, 31 Dec 2021 14:01:12 +0100
parent 12138:644ca3583837
child 12406:a3ddf3f42212
child 12724:5b5b428d67e2
comparison
equal deleted inserted replaced
12139:7d6497294d92 12140:1a4c61253932
68 error("invalid attributes: expected table, got "..type(attr)); 68 error("invalid attributes: expected table, got "..type(attr));
69 end 69 end
70 for k, v in pairs(attr) do 70 for k, v in pairs(attr) do
71 check_name(k, "attribute"); 71 check_name(k, "attribute");
72 check_text(v, "attribute"); 72 check_text(v, "attribute");
73 if type(v) ~= "string" then
74 error("invalid attribute value for '"..k.."': expected string, got "..type(v));
75 elseif not valid_utf8(v) then
76 error("invalid attribute value for '"..k.."': contains invalid utf8");
77 end
78 end 73 end
79 end 74 end
80 end 75 end
81 76
82 local function new_stanza(name, attr, namespaces) 77 local function new_stanza(name, attr, namespaces)