Protect loading of connlisteners, to catch errors

Tue, 16 Dec 2008 02:32:01 +0000

author
Matthew Wild <mwild1@gmail.com>
date
Tue, 16 Dec 2008 02:32:01 +0000
changeset 624
04fe1a00aa16
parent 623
5af5a64a729f
child 625
cad4dcfbf295

Protect loading of connlisteners, to catch errors

net/connlisteners.lua file | annotate | diff | comparison | revisions
--- a/net/connlisteners.lua	Tue Dec 16 02:30:24 2008 +0000
+++ b/net/connlisteners.lua	Tue Dec 16 02:32:01 2008 +0000
@@ -47,7 +47,8 @@
 function get(name)
 	local h = listeners[name];
 	if not h then
-		pcall(dofile, listeners_dir..name:gsub("[^%w%-]", "_").."_listener.lua");
+		local ok, ret = pcall(dofile, listeners_dir..name:gsub("[^%w%-]", "_").."_listener.lua");
+		if not ok then return nil, ret; end
 		h = listeners[name];
 	end
 	return h;

mercurial