Changeset

713:2afd6d9e21cd

modulemanager: Check for syntax errors before reloading a module
author Waqas Hussain <waqas20@gmail.com>
date Tue, 13 Jan 2009 23:16:39 +0500
parents 712:56410c0cd846
children 714:ab3c47f4fe1d
files core/modulemanager.lua
diffstat 1 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/core/modulemanager.lua	Tue Jan 13 22:39:07 2009 +0500
+++ b/core/modulemanager.lua	Tue Jan 13 23:16:39 2009 +0500
@@ -164,6 +164,12 @@
 	local mod = modulemap[host] and modulemap[host][name];
 	if not mod then return nil, "module-not-loaded"; end
 
+	local _mod, err = loadfile(plugin_dir.."mod_"..name..".lua"); -- checking for syntax errors
+	if not _mod then
+		log("error", "Unable to load module '%s': %s", module_name or "nil", err or "nil");
+		return nil, err;
+	end
+
 	local saved;
 	if type(mod.module.save) == "function" then
 		local ok, err = pcall(mod.module.save)