Skip to content

node errors: give AbortError a real constructor so util.inspect prints its class name - #39300

Closed
robobun wants to merge 4 commits into
mainfrom
farm/d8da4efd/abort-error-constructor
Closed

robobun wants to merge 4 commits into
mainfrom
farm/d8da4efd/abort-error-constructor

node errors: give AbortError a real constructor so util.inspect print…

34d14b0
Select commit
Loading
Failed to load commit list.
Claude / Claude Code Review completed Aug 16, 2026 in 14m 21s

Code review found 1 potential issue

Found 1 candidates, confirmed 1. See review comments for details.

Details

Severity Count
🔴 Important 0
🟡 Nit 1
🟣 Pre-existing 0
Severity File:Line Issue
🟡 Nit src/jsc/bindings/ErrorCode.cpp:1778 AbortError constructor accepts primitive number/boolean options without throwing

Annotations

Check warning on line 1778 in src/jsc/bindings/ErrorCode.cpp

See this annotation in the file changed.

@claude claude / Claude Code Review

AbortError constructor accepts primitive number/boolean options without throwing

The `options` validation in `jsFunctionMakeAbortError` only rejects non-object *cells* — numbers and booleans are immediate JSValues (not cells), so `options.isCell()` is false and `new err.constructor('m', 42)` / `new err.constructor('m', true)` silently succeed, whereas Node throws `ERR_INVALID_ARG_TYPE`. This is pre-existing code, but this PR newly exposes it as the user-reachable `err.constructor` and claims Node parity for this check; changing the guard to `!options.isUndefinedOrNull() && !