aboutsummaryrefslogtreecommitdiffstats
path: root/util/debug.lua
diff options
context:
space:
mode:
Diffstat (limited to 'util/debug.lua')
-rw-r--r--util/debug.lua10
1 files changed, 9 insertions, 1 deletions
diff --git a/util/debug.lua b/util/debug.lua
index f70e20dd..9fd0f9dd 100644
--- a/util/debug.lua
+++ b/util/debug.lua
@@ -88,7 +88,15 @@ function get_traceback_table(thread, start_level)
return levels;
end
-function debug.traceback(thread, message, level)
+function debug.traceback(...)
+ local ok, ret = pcall(debug._traceback, ...);
+ if not ok then
+ return "Error in error handling: "..ret;
+ end
+ return ret;
+end
+
+function debug._traceback(thread, message, level)
if type(thread) ~= "thread" then
thread, message, level = coroutine.running(), thread, message;
end