Software /
code /
prosody
Comparison
util/debug.lua @ 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 |
parent | 4519:510f4ba7080f |
child | 4521:4c7495f7f543 |
comparison
equal
deleted
inserted
replaced
4519:510f4ba7080f | 4520:2d85ac26799c |
---|---|
86 }; | 86 }; |
87 end | 87 end |
88 return levels; | 88 return levels; |
89 end | 89 end |
90 | 90 |
91 function debug.traceback(thread, message, level) | 91 function debug.traceback(...) |
92 local ok, ret = pcall(debug._traceback, ...); | |
93 if not ok then | |
94 return "Error in error handling: "..ret; | |
95 end | |
96 return ret; | |
97 end | |
98 | |
99 function debug._traceback(thread, message, level) | |
92 if type(thread) ~= "thread" then | 100 if type(thread) ~= "thread" then |
93 thread, message, level = coroutine.running(), thread, message; | 101 thread, message, level = coroutine.running(), thread, message; |
94 end | 102 end |
95 if level and type(message) ~= "string" then | 103 if level and type(message) ~= "string" then |
96 return nil, "invalid message"; | 104 return nil, "invalid message"; |