util.error: Minor tweaks to error creation code to prepare for future changes
authorMatthew Wild <mwild1@gmail.com>
Fri, 25 Sep 2020 12:27:45 +0100
changeset 11081 8ea430de5fd3
parent 11080 505c3e5907a5
child 11082 fb3aec3dbe21
util.error: Minor tweaks to error creation code to prepare for future changes
util/error.lua
--- 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)