From 9d7ce06a96e15073938462d79940358f50642198 Mon Sep 17 00:00:00 2001 From: batrick Date: Thu, 21 Jul 2011 17:46:16 +0000 Subject: [PATCH] better error message when script fails to load (now includes traceback of the script) --- nse_main.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/nse_main.lua b/nse_main.lua index 7a6cc74ad..42f21f510 100644 --- a/nse_main.lua +++ b/nse_main.lua @@ -400,7 +400,11 @@ do setmetatable(env, {__index = _G}); setfenv(file_closure, env); local co = create(file_closure); -- Create a garbage thread - local status, e = assert(resume(co)); -- Get the globals it loads in env + local status, e = resume(co); -- Get the globals it loads in env + if not status then + log_error("Failed to load %s:\n%s", filename, traceback(co, e)); + error("could not load script"); + end if quiet_errors[e] then print_verbose(1, "Failed to load '%s'.", filename); return nil;