]> git.e2factory.org Git - e2factory.git/commitdiff
Remove all traces of e2lib.bomb
authorTobias Ulmer <tu@emlix.com>
Fri, 12 Jul 2013 15:42:13 +0000 (17:42 +0200)
committerTobias Ulmer <tu@emlix.com>
Wed, 16 Nov 2016 14:01:23 +0000 (15:01 +0100)
Signed-off-by: Tobias Ulmer <tu@emlix.com>
Coding
generic/e2lib.lua

diff --git a/Coding b/Coding
index 2499ada83678a99a822a5d8d1cecd9864f7c5294..fb9b913546b2c7b9052ea9350a538c1eaf4302d6 100644 (file)
--- a/Coding
+++ b/Coding
@@ -9,11 +9,6 @@ Error handling
    * ignoring them (that usually requires a comment)
    * nesting them into another error object from the current layer
  * errors shall not be handled by calling e2lib.abort().
- * calling e2lib.bomb() is allowed when signalling a bug in the tool.
-   E.g. when checking function call parameters, which should never fail.
-   We need the call stack in those cases to fix that bug.
- * the behaviour if e2lib.bomb() may be different when delivering e2factory
-   to customers. (As they should not see the internals.)
  * Example:
    -- the error object from the current layer is usually named 'e'.
    e = err.new("error copying file for")
index badf0b3b5b088bfb2e1e1781373d485de3136ecf..20cb70677a0ea45a42db83e5f41c6bccc5daace1 100644 (file)
@@ -359,10 +359,11 @@ end
 -- @return nil
 function e2lib.warnf(category, format, ...)
     if (format:len() == 0) or (not format) then
-        e2lib.bomb("calling warnf() with zero length format")
+        e2lib.log(1, "Internal error: calling warnf() with zero length format")
     end
     if type(e2lib.globals.warn_category[category]) ~= "boolean" then
-        e2lib.bomb("calling warnf() with invalid warning category")
+        e2lib.log(1,
+            "Internal error: calling warnf() with invalid warning category")
     end
     if e2lib.globals.warn_category[category] == true then
         local prefix = "Warning: "
@@ -371,7 +372,6 @@ function e2lib.warnf(category, format, ...)
         end
         e2lib.log(1, prefix .. string.format(format, ...))
     end
-    return nil
 end
 
 --- Exit, cleaning up temporary files and directories.
@@ -388,33 +388,14 @@ function e2lib.abort(...)
     else
         local msg = table.concat(t)
         if msg:len() == 0 then
-            e2lib.bomb("calling abort() with zero length message")
+            e2lib.log(1,
+                "Internal error: calling abort() with zero length message")
         end
         e2lib.log(1, "Error: " .. msg)
     end
     e2lib.finish(1)
 end
 
---- Write a message about an internal error, including a traceback
--- and exit. Return code is 32.
--- @param ... any number of strings.
--- @return This function does not return.
-function e2lib.bomb(...)
-    local msg = table.concat({...})
-    io.stderr:write(
-    "Internal Error:\n" ..
-    msg .. "\n" ..
-    "\n" ..
-    "You encountered an internal error in the e2 tool.\n" ..
-    "Please send a description of the problem, including the\n" ..
-    "stacktrace below to <bugs@e2factory.org>.\n" ..
-    "If possible include a copy of the project in the bug report.\n" ..
-    "\n" ..
-    "Thank you - the e2factory team.\n")
-    io.stderr:write(debug.traceback().."\n")
-    os.exit(32)
-end
-
 --- Set E2_CONFIG in the environment to file. Also sets commandline option.
 -- @param file Config file name (string).
 function e2lib.sete2config(file)
@@ -477,7 +458,7 @@ end
 -- @return nil
 function e2lib.logf(level, format, ...)
     if not format then
-        e2lib.bomb("calling log() without format string")
+        e2lib.log(1, "Internal error: calling logf() without format string")
     end
     local msg = string.format(format, ...)
     return e2lib.log(level, msg)
@@ -489,10 +470,10 @@ end
 -- @param msg string: log message
 function e2lib.log(level, msg)
     if level < 1 or level > 4 then
-        e2lib.bomb("invalid log level")
+        e2lib.log(1, "Internal error: invalid log level")
     end
     if not msg then
-        e2lib.bomb("calling log() without log message")
+        e2lib.log(1, "Internal error: calling log() without log message")
     end
     local log_prefix = "[" .. level .. "] "
     -- remove end of line if it exists