diff options
author | Matthew Wild <mwild1@gmail.com> | 2020-12-09 13:59:51 +0000 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2020-12-09 13:59:51 +0000 |
commit | d9c8000cc75a554ef99315f16a28c47395e0afbb (patch) | |
tree | 90db9091db6f8c88a7c383a36690539936ddd0c3 /util | |
parent | e875910c5db89d3f1752b878357f0a164a1936a2 (diff) | |
download | prosody-d9c8000cc75a554ef99315f16a28c47395e0afbb.tar.gz prosody-d9c8000cc75a554ef99315f16a28c47395e0afbb.zip |
util.error: rename is_err() -> is_error()
More descriptive and consistent with e.g. is_promise().
Diffstat (limited to 'util')
-rw-r--r-- | util/error.lua | 11 |
1 files changed, 6 insertions, 5 deletions
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; } |