Changeset

11079:1e5a0e0469de

util.error: Switch coerce() to use new() and change 'native' to context field 'wrapped_error'
author Matthew Wild <mwild1@gmail.com>
date Fri, 25 Sep 2020 12:38:58 +0100
parents 11078:fb3aec3dbe21
children 11080:ba77c142c9b1
files util/error.lua
diffstat 1 files changed, 3 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/util/error.lua	Fri Sep 25 12:32:43 2020 +0100
+++ b/util/error.lua	Fri Sep 25 12:38:58 2020 +0100
@@ -70,12 +70,10 @@
 		return ok, err, ...;
 	end
 
-	local new_err = setmetatable({
-		native = err;
+	local new_err = new({
+		type = "cancel", condition = "undefined-condition"
+	}, { wrapped_error = err });
 
-		type = "cancel";
-		condition = "undefined-condition";
-	}, error_mt);
 	return ok, new_err, ...;
 end