Diff

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
line wrap: on
line diff
--- a/mod_rest/mod_rest.lua	Mon Apr 21 17:57:48 2025 +0200
+++ b/mod_rest/mod_rest.lua	Tue Apr 22 09:40:20 2025 +0200
@@ -664,6 +664,7 @@
 
 -- strip some stuff, notably the optional traceback table that casues stack overflow in util.json
 local function simplify_error(e)
+	if not e then return end
 	return {
 		type = e.type;
 		condition = e.condition;