Skip to content

Commit 0f5c5aa

Browse files
TheLartiansPerryvw
authored andcommitted
Support non-string errors with SourceMapTraceback (#741)
* support custom errors with SourceMapTraceback * pass-through non-string tracebacks * minimize changes
1 parent 5d2d64b commit 0f5c5aa

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/lualib/SourceMapTraceBack.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ function __TS__SourceMapTraceBack(this: void, fileName: string, sourceMap: { [li
88
globalThis.__TS__originalTraceback = debug.traceback;
99
debug.traceback = (thread, message, level) => {
1010
const trace = globalThis.__TS__originalTraceback(thread, message, level);
11+
12+
if (typeof trace !== "string") {
13+
return trace;
14+
}
15+
1116
const [result] = string.gsub(trace, "(%S+).lua:(%d+)", (file, line) => {
1217
const fileSourceMap = globalThis.__TS__sourcemap[file + ".lua"];
1318
if (fileSourceMap && fileSourceMap[line]) {

0 commit comments

Comments
 (0)