1
0
Fork 0
mirror of https://github.com/Reuh/candran.git synced 2025-10-27 09:59:29 +00:00

Allow rewriting without new traceback

This commit is contained in:
Étienne Fildadut 2021-05-17 15:19:55 +02:00
parent a3f05f5046
commit f5752cd231
3 changed files with 5 additions and 5 deletions

View file

@ -265,8 +265,8 @@ end
--- Candran error message handler.
-- Use it in xpcall to rewrite stacktraces to display Candran source file lines instead of compiled Lua lines.
function candran.messageHandler(message)
if not message:match("\nstack traceback:\n") then
function candran.messageHandler(message, noTraceback)
if not noTraceback and not message:match("\nstack traceback:\n") then
message = debug.traceback(message, 2)
end
return message:gsub("(\n?%s*)([^\n]-)%:(%d+)%:", function(indentation, source, line)