Software /
code /
prosody
Changeset
9569:0bc399953c27
util.serialization: Rename non-fatal fallback handler for clarity
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sat, 27 Oct 2018 12:54:57 +0200 |
parents | 9568:69f589c888e7 |
children | 9570:ce403b6470f8 |
files | util/serialization.lua |
diffstat | 1 files changed, 3 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/util/serialization.lua Sat Oct 27 12:48:48 2018 +0200 +++ b/util/serialization.lua Sat Oct 27 12:54:57 2018 +0200 @@ -38,7 +38,7 @@ 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 @@ 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 @@ 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);