aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2018-10-27 12:38:47 +0200
committerKim Alvefur <zash@zash.se>2018-10-27 12:38:47 +0200
commitfe4440f49766a0a7d18af2a3a4aaa2932c3b278d (patch)
tree7fd863b3d5709f3238f291dd04eb3e94a734b039
parent956b687a20aa70f62ca803b671be7f8434e66e00 (diff)
downloadprosody-fe4440f49766a0a7d18af2a3a4aaa2932c3b278d.tar.gz
prosody-fe4440f49766a0a7d18af2a3a4aaa2932c3b278d.zip
util.serialization: Separate errors for multiple table references and max depth
-rw-r--r--util/serialization.lua7
1 files changed, 5 insertions, 2 deletions
diff --git a/util/serialization.lua b/util/serialization.lua
index 401bf6f8..998b16de 100644
--- a/util/serialization.lua
+++ b/util/serialization.lua
@@ -128,8 +128,11 @@ local function new(opt)
-- l - position in o of where to insert next token
-- d - depth, used for indentation
local function serialize_table(t, o, l, d)
- if o[t] or d > maxdepth then
- o[l], l = fallback(t, "recursion"), l + 1;
+ if o[t] then
+ o[l], l = fallback(t, "table has multiple references"), l + 1;
+ return l;
+ elseif d > maxdepth then
+ o[l], l = fallback(t, "max table depth reached"), l + 1;
return l;
end