diff --git a/birb/core/debug.lua b/birb/core/debug.lua index 9a7ae66..d23a115 100644 --- a/birb/core/debug.lua +++ b/birb/core/debug.lua @@ -125,6 +125,17 @@ function DebugSystem:logError(context, string) end end +--- Log an error and fail +-- +-- @param context the context of the log +-- @param string the logged string +function DebugSystem:fail(context, string) + if (self:isError()) then + print(self:createLogLine("ERROR", context, string)) + error(string) + end +end + --- Create a formatted debug line -- -- @param level the level of the log