Summary
Boa is missing the SuppressedError builtin, which is part of the ECMAScript 2024
standard. This is a blocking gap for the Explicit Resource Management feature
(using / await using) - without it, the engine cannot correctly handle errors
that occur during resource disposal as required by the DisposeResources abstract
operation.
Current Behavior
Calling SuppressedError in Boa throws a ReferenceError because the constructor
does not exist:
new SuppressedError(new Error("dispose failed"), new Error("original"), "suppressed")
// ReferenceError: SuppressedError is not defined
Additionally, if a using block exits with an error and [Symbol.dispose]() also
throws, the engine has no mechanism to wrap both errors — the original error is
silently lost.
Expected Behavior
SuppressedError should be available as a global builtin that inherits from
Error.prototype, with the following constructor signature:
new SuppressedError(error, suppressed [, message])
And expose the following instance properties:
| Property |
Description |
.error |
The new error thrown during disposal |
.suppressed |
The original error that was suppressed |
.message |
Optional message string, defaults to "" |
.name |
"SuppressedError" |
.stack |
Inherited from Error.prototype |
Acceptance Criteria
Implementation note: The closest reference in the codebase is AggregateError
in core/engine/src/builtins/error/aggregate.rs - SuppressedError should follow
the same pattern. Files to touch:
| File |
Change |
core/engine/src/builtins/error/suppressed.rs |
[new] |
core/engine/src/builtins/error/mod.rs |
[modify] Register as native error |
core/engine/src/context/intrinsics.rs |
[modify] Add to standard constructors |
core/engine/src/error.rs |
[modify] Add SuppressedError to JsNativeErrorKind |
Spec Reference
Summary
Boa is missing the
SuppressedErrorbuiltin, which is part of the ECMAScript 2024standard. This is a blocking gap for the Explicit Resource Management feature
(
using/await using) - without it, the engine cannot correctly handle errorsthat occur during resource disposal as required by the
DisposeResourcesabstractoperation.
Current Behavior
Calling
SuppressedErrorin Boa throws aReferenceErrorbecause the constructordoes not exist:
Additionally, if a
usingblock exits with an error and[Symbol.dispose]()alsothrows, the engine has no mechanism to wrap both errors — the original error is
silently lost.
Expected Behavior
SuppressedErrorshould be available as a global builtin that inherits fromError.prototype, with the following constructor signature:And expose the following instance properties:
.error.suppressed.message"".name"SuppressedError".stackError.prototypeAcceptance Criteria
SuppressedErroris available as a global constructornew SuppressedError(error, suppressed, message)correctly sets.error,.suppressed, and.messagepropertiesSuppressedError.prototypeinherits fromError.prototypeSuppressedError.prototype.nameis"SuppressedError"new SuppressedError() instanceof Errorreturnstruenew SuppressedError() instanceof SuppressedErrorreturnstrueSuppressedErrorvariant is added toJsNativeErrorKindso the VM canthrow it natively from Rust-side disposal logic
SuppressedErrorpassImplementation note: The closest reference in the codebase is
AggregateErrorin
core/engine/src/builtins/error/aggregate.rs-SuppressedErrorshould followthe same pattern. Files to touch:
core/engine/src/builtins/error/suppressed.rscore/engine/src/builtins/error/mod.rscore/engine/src/context/intrinsics.rscore/engine/src/error.rsSuppressedErrortoJsNativeErrorKindSpec Reference