From: Tobias Ulmer Date: Tue, 9 Apr 2019 14:01:27 +0000 (+0200) Subject: e2lib: misuse of warnf() should trigger an assertion X-Git-Tag: e2factory-2.3.18rc1~15 X-Git-Url: https://git.e2factory.org/?a=commitdiff_plain;h=a7418a62d6511a9441e35589382f1339ab4e53bf;p=e2factory.git e2lib: misuse of warnf() should trigger an assertion Signed-off-by: Tobias Ulmer --- diff --git a/generic/e2lib.lua b/generic/e2lib.lua index 5b0c831..d634ee2 100644 --- a/generic/e2lib.lua +++ b/generic/e2lib.lua @@ -686,13 +686,11 @@ end -- @param ... arguments required for the format string -- @return nil function e2lib.warnf(category, format, ...) - if (format:len() == 0) or (not format) then - e2lib.log(1, "Internal error: calling warnf() with zero length format") - end - if type(e2lib.globals.warn_category[category]) ~= "boolean" then - e2lib.log(1, - "Internal error: calling warnf() with invalid warning category") - end + assertIsStringN(format, + "Internal error: called warnf() with invalid format") + assertIsBoolean(e2lib.globals.warn_category[category], + "Internal error: called warnf() with invalid warning category") + if e2lib.globals.warn_category[category] == true then local prefix = "Warning: " if e2lib.globals.log_debug then