Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions Source/JavaScriptCore/runtime/Error.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -267,14 +267,19 @@ JSObject* addErrorInfo(VM& vm, JSObject* error, int line, const SourceCode& sour
if (!sourceURL.isEmpty()) {
errorInstance->setSourceURL(sourceURL);
}
#endif

errorInstance->materializeErrorInfoIfNeeded(vm);

#if USE(BUN_JSC_ADDITIONS)
if (hostComputes)
if (hostComputes) {
// The host's formatter can run user code (Error.prepareStackTrace), so it can throw. The caller made this
// error to throw it, or to hand it to someone who does, and expects no exception from here: what the
// formatter threw is dropped, short of a termination.
auto catchScope = DECLARE_TOP_EXCEPTION_SCOPE(vm);
errorInstance->materializeErrorInfoIfNeeded(vm);
catchScope.clearExceptionExceptTermination();
return errorInstance;
}
#endif

errorInstance->materializeErrorInfoIfNeeded(vm);
}

// Without such a host, materializing takes line and sourceURL from the top frame of the stack (the caller of eval or
Expand Down
Loading