Changeset

11077:8ea430de5fd3

util.error: Minor tweaks to error creation code to prepare for future changes
author Matthew Wild <mwild1@gmail.com>
date Fri, 25 Sep 2020 12:27:45 +0100
parents 11076:505c3e5907a5
children 11078:fb3aec3dbe21
files util/error.lua
diffstat 1 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/util/error.lua	Fri Sep 25 12:19:30 2020 +0100
+++ b/util/error.lua	Fri Sep 25 12:27:45 2020 +0100
@@ -42,16 +42,19 @@
 		context.traceback = debug.traceback("error stack", 2);
 	end
 
-	return setmetatable({
+	local error_instance = setmetatable({
 		instance_id = id.short();
+
 		type = template.type or "cancel";
 		condition = template.condition or "undefined-condition";
 		text = template.text;
 		code = template.code;
 
-		context = context or template.context or { _error_id = e };
+		context = context;
 		source = source;
 	}, error_mt);
+
+	return error_instance;
 end
 
 local function init(source, registry)