mirror of
https://github.com/oven-sh/bun
synced 2026-02-11 19:38:58 +00:00
When Error.prepareStackTrace is defined with Object.defineProperty using a custom getter, the getter was not being invoked when formatting stack traces. This broke modules like error-callsites and elastic-apm-node. Root cause: Bun was directly accessing cached values instead of checking if the property had a custom accessor descriptor. Fix: Check if the property is an accessor (slot.isAccessor()) before calling getIfPropertyExists(). This ensures: - Custom getters (Object.defineProperty) are properly invoked - Data descriptors continue to use fast cached path - No performance regression for normal error handling Added RAII-style cleanup using WTF::makeScopeExit for recursion guard. Fixes #23493 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>