diff options
author | Kim Alvefur <zash@zash.se> | 2018-10-27 12:54:57 +0200 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2018-10-27 12:54:57 +0200 |
commit | 14978069896e87083fd46795cc26b2f58b24828f (patch) | |
tree | 83d0aa90ed5058e4248a499d811db5d47c990aba | |
parent | 28031d133df8b9f7f25edcc9fde46147400127d1 (diff) | |
download | prosody-14978069896e87083fd46795cc26b2f58b24828f.tar.gz prosody-14978069896e87083fd46795cc26b2f58b24828f.zip |
util.serialization: Rename non-fatal fallback handler for clarity
-rw-r--r-- | util/serialization.lua | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/util/serialization.lua b/util/serialization.lua index 52e89136..8ef8048d 100644 --- a/util/serialization.lua +++ b/util/serialization.lua @@ -38,7 +38,7 @@ local function fatal_error(obj, why) error("Can't serialize "..type(obj) .. (why and ": ".. why or "")); end -local function default_fallback(x, why) +local function nonfatal_fallback(x, why) return s_format("nil --[[%s: %s]]", type(x), why or "fail"); end @@ -84,7 +84,7 @@ local function new(opt) opt.preset = "oneline"; opt.freeze = true; opt.fatal = false; - opt.fallback = default_fallback; + opt.fallback = nonfatal_fallback; opt.unquoted = true; end if opt.preset == "oneline" then @@ -100,7 +100,7 @@ local function new(opt) opt.unquoted = true; end - local fallback = opt.fallback or opt.fatal == false and default_fallback or fatal_error; + local fallback = opt.fallback or opt.fatal == false and nonfatal_fallback or fatal_error; local function ser(v) return (types[type(v)] or fallback)(v); |