Comparison

mod_rest/mod_rest.lua @ 6244:c71d8bc77c95

mod_rest: Skip unpacking error object when missing (thanks Martin) Not every "http-error" event includes a .error field, so it may attempt to unpack `nil`.
author Kim Alvefur <zash@zash.se>
date Tue, 22 Apr 2025 09:40:20 +0200
parent 6206:ac7e2992fe6e
comparison
equal deleted inserted replaced
6243:e2648638f3e0 6244:c71d8bc77c95
662 "application/json", 662 "application/json",
663 }; 663 };
664 664
665 -- strip some stuff, notably the optional traceback table that casues stack overflow in util.json 665 -- strip some stuff, notably the optional traceback table that casues stack overflow in util.json
666 local function simplify_error(e) 666 local function simplify_error(e)
667 if not e then return end
667 return { 668 return {
668 type = e.type; 669 type = e.type;
669 condition = e.condition; 670 condition = e.condition;
670 text = e.text; 671 text = e.text;
671 extra = e.extra; 672 extra = e.extra;