Changeset

4520:2d85ac26799c

util.debug: Add catch for an "error in error handling"
author Matthew Wild <mwild1@gmail.com>
date Thu, 22 Mar 2012 15:08:21 +0000
parents 4519:510f4ba7080f
children 4521:4c7495f7f543
files util/debug.lua
diffstat 1 files changed, 9 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/util/debug.lua	Thu Mar 22 15:07:27 2012 +0000
+++ b/util/debug.lua	Thu Mar 22 15:08:21 2012 +0000
@@ -88,7 +88,15 @@
 	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