main: Make undefined actions throw a proper scansion error

Fri, 28 Dec 2018 11:38:56 +0000

author
Matthew Wild <mwild1@gmail.com>
date
Fri, 28 Dec 2018 11:38:56 +0000
changeset 161
fadae5511044
parent 160
28aa762f11c7
child 162
f888f236321f

main: Make undefined actions throw a proper scansion error

main.lua file | annotate | diff | comparison | revisions
--- a/main.lua	Fri Dec 28 04:41:09 2018 -0500
+++ b/main.lua	Fri Dec 28 11:38:56 2018 +0000
@@ -202,8 +202,12 @@
 		for i, action in ipairs(script.actions) do
 			local object = script.objects[action.object_name];
 			local handler = object.handler;
-			assert(handler[action.action], "Objects of type '"..object.type.."' do not support action '"..action.action.."'");
-
+			if not handler[action.action] then
+				local e = new_error("unsupported-action", {
+					text = "Objects of type '"..object.type.."' do not support action '"..action.action.."'";
+				});
+				error(e);
+			end
 			if server_log_reader then
 				log_data("server", { lines = server_log_reader() });
 			end

mercurial