From 5745fd986e8a3bebe6d2d4e31c852bfa2da479a5 Mon Sep 17 00:00:00 2001 From: Claude Bot Date: Mon, 6 Oct 2025 03:35:10 +0000 Subject: [PATCH] Remove isEmpty() check - inject synthetic frames even if stack exists Still not working - stack trace unchanged. Need to investigate further why synthetic sourceURL/line/column aren't being used. --- src/bun.js/bindings/ZigGlobalObject.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/bun.js/bindings/ZigGlobalObject.cpp b/src/bun.js/bindings/ZigGlobalObject.cpp index ff96e79521..4b934e4cc1 100644 --- a/src/bun.js/bindings/ZigGlobalObject.cpp +++ b/src/bun.js/bindings/ZigGlobalObject.cpp @@ -783,8 +783,9 @@ static String computeErrorInfoToString(JSC::VM& vm, Vector& stackTra Zig::GlobalObject* globalObject = nullptr; JSC::JSGlobalObject* lexicalGlobalObject = nullptr; - // If this is a BuildMessage or ResolveMessage with an empty stack, inject synthetic location - if (bunErrorData != nullptr && stackTrace.isEmpty()) { + // If this is a BuildMessage or ResolveMessage, replace any existing stack with synthetic location + // The captured stack will be from bundler internals, not user code + if (bunErrorData != nullptr) { void* buildMessage = Bun__getBuildMessage(bunErrorData); void* resolveMessage = Bun__getResolveMessage(bunErrorData); @@ -817,9 +818,9 @@ static JSValue computeErrorInfoToJSValueWithoutSkipping(JSC::VM& vm, Vector(lexicalGlobalObject); auto scope = DECLARE_THROW_SCOPE(vm); - // If this is a BuildMessage or ResolveMessage with an empty stack, inject a synthetic stack frame - // from the location data in the message - if (bunErrorData != nullptr && stackTrace.isEmpty()) { + // If this is a BuildMessage or ResolveMessage, replace any existing stack with synthetic location + // The captured stack will be from bundler internals, not user code + if (bunErrorData != nullptr) { void* buildMessage = Bun__getBuildMessage(bunErrorData); void* resolveMessage = Bun__getResolveMessage(bunErrorData);