aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2012-03-22 15:08:21 +0000
committerMatthew Wild <mwild1@gmail.com>2012-03-22 15:08:21 +0000
commit5030d1d07c3cd2d9ec1770630f6b6e3ab3565233 (patch)
tree7b49f964bcf40e94f1fda8ac5bbb064f7ce66222
parent995f757ab22f6c4bfbba4eb41d337a5314ef9086 (diff)
downloadprosody-5030d1d07c3cd2d9ec1770630f6b6e3ab3565233.tar.gz
prosody-5030d1d07c3cd2d9ec1770630f6b6e3ab3565233.zip
util.debug: Add catch for an "error in error handling"
-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