diff options
author | 2023-06-28 21:45:16 -0700 | |
---|---|---|
committer | 2023-06-28 21:45:16 -0700 | |
commit | 8481f2922f4f6fe07f8b44067fe478cb1ac1706a (patch) | |
tree | 907a09dfb98c27531ca6f22b8a862fcae76dfe7c /src/bun.js/bindings/ZigGlobalObject.cpp | |
parent | 68e6fe00a4be7857f474cb3aa80e0d876499e3f8 (diff) | |
download | bun-8481f2922f4f6fe07f8b44067fe478cb1ac1706a.tar.gz bun-8481f2922f4f6fe07f8b44067fe478cb1ac1706a.tar.zst bun-8481f2922f4f6fe07f8b44067fe478cb1ac1706a.zip |
Add GC test for errors
Diffstat (limited to 'src/bun.js/bindings/ZigGlobalObject.cpp')
-rw-r--r-- | src/bun.js/bindings/ZigGlobalObject.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/bun.js/bindings/ZigGlobalObject.cpp b/src/bun.js/bindings/ZigGlobalObject.cpp index 9ff3ebf93..7ba0f0b30 100644 --- a/src/bun.js/bindings/ZigGlobalObject.cpp +++ b/src/bun.js/bindings/ZigGlobalObject.cpp @@ -390,7 +390,11 @@ static String computeErrorInfoWithoutPrepareStackTrace(JSC::VM& vm, Vector<Stack frame.computeLineAndColumn(thisLine, thisColumn); remappedFrames[i].position.line = thisLine; remappedFrames[i].position.column_start = thisColumn; - remappedFrames[i].source_url = Bun::toString(frame.sourceURL(vm)); + String sourceURLForFrame = frame.sourceURL(vm); + + if (!sourceURLForFrame.isEmpty()) { + remappedFrames[i].source_url = Bun::toString(sourceURLForFrame); + } // This ensures the lifetime of the sourceURL is accounted for correctly Bun__remapStackFramePositions(globalObject, remappedFrames + i, 1); @@ -409,7 +413,7 @@ static String computeErrorInfoWithoutPrepareStackTrace(JSC::VM& vm, Vector<Stack } } - sb.append(frame.sourceURL(vm)); + sb.append(sourceURLForFrame); sb.append(":"_s); sb.append(remappedFrames[i].position.line); sb.append(":"_s); |