From 715525f31ba95e35adb0dde43b3f0edccc1804f5 Mon Sep 17 00:00:00 2001 From: batrick Date: Sun, 5 Aug 2012 09:16:04 +0000 Subject: [PATCH] Throw an actual error. Do not yield. --- nse_main.lua | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/nse_main.lua b/nse_main.lua index a317d0219..ce83c56ff 100644 --- a/nse_main.lua +++ b/nse_main.lua @@ -252,8 +252,7 @@ rawset(stdnse, "silent_require", function (...) local status, mod = pcall(require, ...); if not status then print_debug(1, "%s", traceback(mod)); - yield(REQUIRE_ERROR); -- use script yield - error(mod); + error(REQUIRE_ERROR) else return mod; end @@ -457,12 +456,13 @@ do local co = create(script_closure); -- Create a garbage thread 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; + if quiet_errors[e] then + print_verbose(1, "Failed to load '%s'.", filename); + return nil; + else + log_error("Failed to load %s:\n%s", filename, traceback(co, e)); + error("could not load script"); + end end -- Check that all the required fields were set for f, t in pairs(required_fields) do