mirror of
https://github.com/nmap/nmap.git
synced 2026-11-12 06:48:51 +00:00
Clarify silent_require load failures
This commit is contained in:
parent
5eb3abcee3
commit
32bffe0975
1 changed files with 6 additions and 1 deletions
|
|
@ -293,6 +293,11 @@ local function K (a)
|
|||
end
|
||||
|
||||
local REQUIRE_ERROR = {};
|
||||
setmetatable(REQUIRE_ERROR, {
|
||||
__tostring = function()
|
||||
return "required module unavailable in this configuration"
|
||||
end
|
||||
})
|
||||
rawset(stdnse, "silent_require", function (...)
|
||||
local status, mod = pcall(require, ...);
|
||||
if not status then
|
||||
|
|
@ -637,7 +642,7 @@ do
|
|||
local status, e = resume(co); -- Get the globals it loads in env
|
||||
if not status then
|
||||
if quiet_errors[e] then
|
||||
print_verbose(1, "Failed to load '%s'.", filename);
|
||||
print_verbose(1, "Failed to load '%s': %s", filename, e);
|
||||
return nil;
|
||||
else
|
||||
log_error("Failed to load %s:\n%s", filename, traceback(co, e));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue