aboutsummaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2020-12-09 13:59:51 +0000
committerMatthew Wild <mwild1@gmail.com>2020-12-09 13:59:51 +0000
commit919a05543a1a77b93298b349343fb697472e6d75 (patch)
tree90db9091db6f8c88a7c383a36690539936ddd0c3 /util
parentdbdf490e62e1651fdd73b706c30c8d9ab3cfe7b0 (diff)
downloadprosody-919a05543a1a77b93298b349343fb697472e6d75.tar.gz
prosody-919a05543a1a77b93298b349343fb697472e6d75.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.lua11
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;
}