Summary
Node exposes V8-compatible static properties on Error: Error.captureStackTrace, Error.isError, Error.stackTraceLimit, and Error.prepareStackTrace. Perry implements Error object allocation and some stack formatting, but does not expose these static helpers/properties on the global Error constructor value.
Node behavior
Local Node v25.9.0:
console.log(typeof Error.captureStackTrace); // "function"
console.log(typeof Error.isError); // "function"
console.log(Error.isError(new Error("x"))); // true
console.log(Error.isError({})); // false
console.log(typeof Error.stackTraceLimit); // "number"
console.log(typeof Error.prepareStackTrace); // "function"
const target = {};
Error.captureStackTrace(target);
console.log(typeof target.stack); // "string"
These APIs are used by many Node libraries for custom error objects, stack hiding, error duck checks, and stack formatting configuration.
Perry evidence
- Source search finds no
Error.isError, js_error_is_error, captureStackTrace, stackTraceLimit, or prepareStackTrace implementation.
docs/typescript-parity-gaps.md still lists Error.captureStackTrace as missing.
crates/perry-runtime/src/error.rs implements Error allocation/stringification and native Error subclasses, but not the static constructor properties above.
crates/perry-runtime/src/object/global_this.rs exposes Error as a built-in constructor sentinel and installs Error.prototype.toString, but there is no static captureStackTrace, isError, stackTraceLimit, or prepareStackTrace property on that constructor.
crates/perry-codegen/src/expr/helpers.rs::is_global_this_builtin_name() treats Error as a global constructor value, but the first-class global constructor path currently does not provide these static members.
Expected behavior: expose the Node-compatible static Error surface, including Error.isError detection for Perry ErrorHeader values/subclasses, captureStackTrace(target[, constructorOpt]) writing a stack string onto arbitrary target objects, and readable/writable stack formatting controls where practical.
Related but not duplicate: #2836 tracks Error { cause } options, #2885 tracks EvalError/URIError construction, and #1278 / #616 covered stack frame format/prefix issues rather than these static properties.
Summary
Node exposes V8-compatible static properties on
Error:Error.captureStackTrace,Error.isError,Error.stackTraceLimit, andError.prepareStackTrace. Perry implements Error object allocation and some stack formatting, but does not expose these static helpers/properties on the globalErrorconstructor value.Node behavior
Local Node v25.9.0:
These APIs are used by many Node libraries for custom error objects, stack hiding, error duck checks, and stack formatting configuration.
Perry evidence
Error.isError,js_error_is_error,captureStackTrace,stackTraceLimit, orprepareStackTraceimplementation.docs/typescript-parity-gaps.mdstill listsError.captureStackTraceas missing.crates/perry-runtime/src/error.rsimplements Error allocation/stringification and native Error subclasses, but not the static constructor properties above.crates/perry-runtime/src/object/global_this.rsexposesErroras a built-in constructor sentinel and installsError.prototype.toString, but there is no staticcaptureStackTrace,isError,stackTraceLimit, orprepareStackTraceproperty on that constructor.crates/perry-codegen/src/expr/helpers.rs::is_global_this_builtin_name()treatsErroras a global constructor value, but the first-class global constructor path currently does not provide these static members.Expected behavior: expose the Node-compatible static Error surface, including
Error.isErrordetection for Perry ErrorHeader values/subclasses,captureStackTrace(target[, constructorOpt])writing a stack string onto arbitrary target objects, and readable/writable stack formatting controls where practical.Related but not duplicate: #2836 tracks Error
{ cause }options, #2885 tracks EvalError/URIError construction, and #1278 / #616 covered stack frame format/prefix issues rather than these static properties.