From d9c8000cc75a554ef99315f16a28c47395e0afbb Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Wed, 9 Dec 2020 13:59:51 +0000 Subject: util.error: rename is_err() -> is_error() More descriptive and consistent with e.g. is_promise(). --- util/error.lua | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'util/error.lua') diff --git a/util/error.lua b/util/error.lua index 173d4b7d..fc7c7f5c 100644 --- a/util/error.lua +++ b/util/error.lua @@ -14,7 +14,7 @@ function error_mt:__tostring() return ("error<%s:%s:%s>"):format(self.type, self.condition, self.text or ""); end -local function is_err(e) +local function is_error(e) return getmetatable(e) == error_mt; end @@ -35,7 +35,7 @@ end -- What to set `type` to for stream errors or SASL errors? Those don't have a 'type' attr. local function new(e, context, registry, source) - if is_err(e) then return e; end + if is_error(e) then return e; end local template = registry and registry[e]; if not template then if type(e) == "table" then @@ -100,7 +100,7 @@ local function init(source, namespace, registry) end local function wrap(e, context) - if is_err(e) then + if is_error(e) then return e; end local err = new(registry[e] or { @@ -127,7 +127,7 @@ local function init(source, namespace, registry) end local function coerce(ok, err, ...) - if ok or is_err(err) then + if ok or is_error(err) then return ok, err, ...; end @@ -165,7 +165,8 @@ return { new = new; init = init; coerce = coerce; - is_err = is_err; + is_error = is_error; + is_err = is_error; -- COMPAT w/ older 0.12 trunk from_stanza = from_stanza; configure = configure; } -- cgit v1.2.3