This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- keep the original print() | |
local _print = print | |
local indentation = "" | |
--- Pretty print a value | |
-- If the value is a table it's content will be printed as well (recursively) | |
local function pretty_print(value) | |
local t = type(value) | |
if t ~= "table" then |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local function on_error(err) | |
print("In custom error handler:", err) | |
-- something went wrong, handle error here | |
-- report to client health for instance | |
-- print(debug.traceback()) | |
-- dump tables | |
end | |
local function do_something(a_number) | |
-- if this check fails it will be caught by the error handler |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local function a() | |
print(debug.traceback()) | |
end | |
local function b() | |
a() | |
end | |
local function c() | |
b() |
NewerOlder