From 553666c3f2d7da937658e5f695ca4d29a4c1851d Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Thu, 22 Mar 2012 15:08:21 +0000 Subject: util.debug: Add catch for an "error in error handling" --- util/debug.lua | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'util') 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 -- cgit v1.2.3