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 | f52dc4985c2cd97bdf3f9807b029793e921c59cf (patch) | |
tree | 83d0aa90ed5058e4248a499d811db5d47c990aba /util/serialization.lua | |
parent | 108f6557fde14df993f54ef217edb605bb1bae71 (diff) | |
download | prosody-f52dc4985c2cd97bdf3f9807b029793e921c59cf.tar.gz prosody-f52dc4985c2cd97bdf3f9807b029793e921c59cf.zip |
util.serialization: Rename non-fatal fallback handler for clarity
Diffstat (limited to 'util/serialization.lua')
-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); |