Diff

net/connlisteners.lua @ 624:04fe1a00aa16

Protect loading of connlisteners, to catch errors
author Matthew Wild <mwild1@gmail.com>
date Tue, 16 Dec 2008 02:32:01 +0000
parent 615:4ae3e81513f3
child 658:1952fdcf1017
line wrap: on
line diff
--- 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;