Comparison

util/error.lua @ 10501:e8186aba1583

util.error: Move default for numeric error code to net.http.server Stanza errors can also have numbers but these are a legacy thing and rarely used, except in MUC. HTTP errors on the other hand always have a number.
author Kim Alvefur <zash@zash.se>
date Sat, 14 Dec 2019 20:28:44 +0100
parent 10493:d9132e7412b8
child 11050:51be24b16e8a
comparison
equal deleted inserted replaced
10500:493cbfe99b64 10501:e8186aba1583
19 local template = (registry and registry[e]) or e or {}; 19 local template = (registry and registry[e]) or e or {};
20 return setmetatable({ 20 return setmetatable({
21 type = template.type or "cancel"; 21 type = template.type or "cancel";
22 condition = template.condition or "undefined-condition"; 22 condition = template.condition or "undefined-condition";
23 text = template.text; 23 text = template.text;
24 code = template.code or 500; 24 code = template.code;
25 25
26 context = context or template.context or { _error_id = e }; 26 context = context or template.context or { _error_id = e };
27 }, error_mt); 27 }, error_mt);
28 end 28 end
29 29