aboutsummaryrefslogtreecommitdiffstats
path: root/util/debug.lua
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
commit553666c3f2d7da937658e5f695ca4d29a4c1851d (patch)
tree7b49f964bcf40e94f1fda8ac5bbb064f7ce66222 /util/debug.lua
parent451abcc73f8315134c31478450b53494f1bfd455 (diff)
downloadprosody-553666c3f2d7da937658e5f695ca4d29a4c1851d.tar.gz
prosody-553666c3f2d7da937658e5f695ca4d29a4c1851d.zip
util.debug: Add catch for an "error in error handling"
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