Changeset

11161:f51ed2652602

util.error: Pass through existing error objects passed to new()
author Matthew Wild <mwild1@gmail.com>
date Thu, 15 Oct 2020 13:43:03 +0100
parents 11160:e9eeaefa09a7
children 11166:51e5149ed0ad
files util/error.lua
diffstat 1 files changed, 1 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/util/error.lua	Tue Oct 13 11:59:40 2020 +0100
+++ b/util/error.lua	Thu Oct 15 13:43:03 2020 +0100
@@ -35,6 +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
 	local template = registry and registry[e];
 	if not template then
 		if type(e) == "table" then