util.error: rename is_err() -> is_error()
authorMatthew Wild <mwild1@gmail.com>
Wed, 09 Dec 2020 13:59:51 +0000
changeset 11226 4b39691a274e
parent 11225 b0a563716334
child 11227 b8589256b404
util.error: rename is_err() -> is_error() More descriptive and consistent with e.g. is_promise().
util/error.lua
--- a/util/error.lua	Wed Dec 09 13:55:10 2020 +0000
+++ b/util/error.lua	Wed Dec 09 13:59:51 2020 +0000
@@ -14,7 +14,7 @@
 	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 @@
 -- 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 @@
 	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 @@
 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 @@
 	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;
 }