Merged
Conversation
Test262 conformance changes
Tested PR commit: |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4828 +/- ##
===========================================
+ Coverage 47.24% 57.36% +10.11%
===========================================
Files 476 554 +78
Lines 46892 60564 +13672
===========================================
+ Hits 22154 34740 +12586
- Misses 24738 25824 +1086 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
ashddev
pushed a commit
to ashddev/boa
that referenced
this pull request
Mar 3, 2026
I was experimenting with the new PanicError and I found it really
useful, but kind of a pain to use. This adjusts its definition such that
it is kind of a replacement for `expect`: you just call `js_expect` on
either a `JsResult` or an `Option` and it automatically creates the
`PanicError`.
### Before
```rust
let promise = self
.stack
.get(frame.promise_capability_promise_register_index())
.expect("stack must have a promise capability")
.as_object()?;
```
After:
```rust
let promise = self
.stack
.get(frame.promise_capability_promise_register_index())
.and_then(JsValue::as_object)
.js_expect("stack must have a promise capability")?;
```
cc @KaustubhOG so that you're aware about the API changes
Contributor
Thanks for the cc! Already using js_expect in #4837 |
github-merge-queue Bot
pushed a commit
that referenced
this pull request
Mar 3, 2026
…4837) Part of #3241 Converts all 14 panics in `jsarray.rs` to use `js_expect` introduced in #4828, replacing `.expect()` calls that would crash the process with recoverable `EngineError::Panic` errors that bubble up to the host application. Changes: - `JsArray::new` now returns `JsResult<Self>` instead of `Self` - All 14 `.expect()` calls replaced with `.js_expect()?` - Updated all callers of `JsArray::new` across the codebase - Fixed doc examples in `jsmap.rs` and `jsobject.rs`
This was referenced Mar 3, 2026
github-merge-queue Bot
pushed a commit
that referenced
this pull request
Mar 3, 2026
…ct (#4844) Part of #3241 Converts all 26 panics in `jstypedarray.rs` to `EngineError::Panic` using the `js_expect` ergonomics introduced in #4828. Unlike #4837 which touched 8 files due to a public API change, this PR only modifies 1 file since no public API signatures were changed all methods already returned `JsResult<T>`, only the internal implementations were updated. Patterns converted: - `.as_number().map(...).expect()` → `.js_expect()?` - `.as_object().expect()` → `.as_object().js_expect()?` - `.as_boolean().expect()` → `.as_boolean().js_expect()?` - `.map(|x| x.as_string().expect())` → `.and_then(|x| x.as_string().js_expect().map_err(Into::into))` - 3 macro panics inside `JsTypedArrayType!` (`from_array_buffer`, `from_shared_array_buffer`, `from_iter`) The 4 remaining `.expect(` in the file are inside `///` doc comment examples, not real code.
hansl
pushed a commit
to hansl/boa
that referenced
this pull request
Mar 3, 2026
…ct (boa-dev#4844) Part of boa-dev#3241 Converts all 26 panics in `jstypedarray.rs` to `EngineError::Panic` using the `js_expect` ergonomics introduced in boa-dev#4828. Unlike boa-dev#4837 which touched 8 files due to a public API change, this PR only modifies 1 file since no public API signatures were changed all methods already returned `JsResult<T>`, only the internal implementations were updated. Patterns converted: - `.as_number().map(...).expect()` → `.js_expect()?` - `.as_object().expect()` → `.as_object().js_expect()?` - `.as_boolean().expect()` → `.as_boolean().js_expect()?` - `.map(|x| x.as_string().expect())` → `.and_then(|x| x.as_string().js_expect().map_err(Into::into))` - 3 macro panics inside `JsTypedArrayType!` (`from_array_buffer`, `from_shared_array_buffer`, `from_iter`) The 4 remaining `.expect(` in the file are inside `///` doc comment examples, not real code.
github-merge-queue Bot
pushed a commit
that referenced
this pull request
Mar 4, 2026
…#4842) Part of #3241 Converts all 12 panics in `jsdataview.rs` to use `js_expect` introduced in #4828, replacing `.expect()` calls that would crash the process with recoverable `EngineError::Panic` errors that bubble up to the host application. No public API changes — all methods already returned `JsResult<T>`, only the internal implementation was updated.
github-merge-queue Bot
pushed a commit
that referenced
this pull request
Mar 4, 2026
…4854) Part of #3241 Converts all 13 panics in `jsproxy.rs` to `EngineError::Panic` using `js_expect` introduced in #4828. `build()` and `build_revocable()` return types changed from `JsProxy`/ `JsRevocableProxy` to `JsResult<JsProxy>`/`JsResult<JsRevocableProxy>`. Checked for external callers —> only a type re-export in `mod.rs`, so the cascade is limited to 1 file. Note: The two `JsNativeError::typ()` usages in `from_object()` and `TryFromJs` are intentionally left unchanged (becauze i think these are correct user-facing TypeErrors, not internal implementation failures.)
ashddev
pushed a commit
to ashddev/boa
that referenced
this pull request
Mar 4, 2026
…oa-dev#4837) Part of boa-dev#3241 Converts all 14 panics in `jsarray.rs` to use `js_expect` introduced in boa-dev#4828, replacing `.expect()` calls that would crash the process with recoverable `EngineError::Panic` errors that bubble up to the host application. Changes: - `JsArray::new` now returns `JsResult<Self>` instead of `Self` - All 14 `.expect()` calls replaced with `.js_expect()?` - Updated all callers of `JsArray::new` across the codebase - Fixed doc examples in `jsmap.rs` and `jsobject.rs`
ashddev
pushed a commit
to ashddev/boa
that referenced
this pull request
Mar 4, 2026
…ct (boa-dev#4844) Part of boa-dev#3241 Converts all 26 panics in `jstypedarray.rs` to `EngineError::Panic` using the `js_expect` ergonomics introduced in boa-dev#4828. Unlike boa-dev#4837 which touched 8 files due to a public API change, this PR only modifies 1 file since no public API signatures were changed all methods already returned `JsResult<T>`, only the internal implementations were updated. Patterns converted: - `.as_number().map(...).expect()` → `.js_expect()?` - `.as_object().expect()` → `.as_object().js_expect()?` - `.as_boolean().expect()` → `.as_boolean().js_expect()?` - `.map(|x| x.as_string().expect())` → `.and_then(|x| x.as_string().js_expect().map_err(Into::into))` - 3 macro panics inside `JsTypedArrayType!` (`from_array_buffer`, `from_shared_array_buffer`, `from_iter`) The 4 remaining `.expect(` in the file are inside `///` doc comment examples, not real code.
ashddev
pushed a commit
to ashddev/boa
that referenced
this pull request
Mar 4, 2026
…boa-dev#4842) Part of boa-dev#3241 Converts all 12 panics in `jsdataview.rs` to use `js_expect` introduced in boa-dev#4828, replacing `.expect()` calls that would crash the process with recoverable `EngineError::Panic` errors that bubble up to the host application. No public API changes — all methods already returned `JsResult<T>`, only the internal implementation was updated.
ashddev
pushed a commit
to ashddev/boa
that referenced
this pull request
Mar 4, 2026
…oa-dev#4854) Part of boa-dev#3241 Converts all 13 panics in `jsproxy.rs` to `EngineError::Panic` using `js_expect` introduced in boa-dev#4828. `build()` and `build_revocable()` return types changed from `JsProxy`/ `JsRevocableProxy` to `JsResult<JsProxy>`/`JsResult<JsRevocableProxy>`. Checked for external callers —> only a type re-export in `mod.rs`, so the cascade is limited to 1 file. Note: The two `JsNativeError::typ()` usages in `from_object()` and `TryFromJs` are intentionally left unchanged (becauze i think these are correct user-facing TypeErrors, not internal implementation failures.)
github-merge-queue Bot
pushed a commit
that referenced
this pull request
Mar 5, 2026
…4846) Part of #3241 Converts all 17 panics in `jsregexp.rs` to `EngineError::Panic` using `js_expect` introduced in #4828. No public API signatures were changed — only 1 file modified. Patterns converted: - `.as_object().expect()` → `.as_object().js_expect()?` - `.map(|v| v.as_boolean().expect())` → `.and_then(|v| v.as_boolean().js_expect().map_err(Into::into))` - `.map(|v| v.as_string().expect()...to_std_string().expect())` → `.and_then(|v| v.as_string().js_expect()?.to_std_string().map_err(...))` - nested `.expect()` calls in `exec()` converted using `?` inside `.and_then()`
github-merge-queue Bot
pushed a commit
that referenced
this pull request
Mar 5, 2026
…4875) Part of #3241 Converts all 23 panics in jspromise.rs to EngineError::Panic using js_expect introduced in #4828. Patterns converted: - `.js_expect()` on internal promise operations that cannot fail - `.js_expect().map_err(Into::into)` for methods returning `JsResult<JsPromise>` Signature changes: - `resolve()`, `reject()`, `from_result()` → `JsResult<Self>` - `then()`, `catch()`, `finally()` → `JsResult<JsPromise>` - `all()`, `all_settled()`, `any()`, `race()` → `JsResult<JsPromise>` - `into_js_future()` → `JsResult<JsFuture>` Files modified: 6
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I was experimenting with the new PanicError and I found it really useful, but kind of a pain to use. This adjusts its definition such that it is kind of a replacement for
expect: you just calljs_expecton either aJsResultor anOptionand it automatically creates thePanicError.Before
After:
cc @KaustubhOG so that you're aware about the API changes