Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

📝 document error boundaries and the scoped() function #960

Merged
merged 1 commit into from
Jan 8, 2025
Merged

Conversation

cowboyd
Copy link
Member

@cowboyd cowboyd commented Jan 7, 2025

Motivation

The way error boundaries are created has changed from v3 to v4. Instead of using call() or action() to establish an error boundary, there is now a dedicated scoped() function which not only traps any errors, but also creates a resource boundary that does not let any resource or task escape.

Approach

This updates the error documentation, and also adds documentation to the scoped() function. Finally, there was an old deno link that I updated to JSR.

@cowboyd cowboyd requested review from taras and neurosnap January 7, 2025 23:41
Comment on lines +16 to +21
* function* example() {
* let signal = yield* scoped(function*() {
* return yield* useAbortSignal();
* });
* return signal.aborted; //=> true
* }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a beautiful little piece of code 😍

The way error boundaries are created has changed from `v3` to `v4`.
Instead of using `call()` or `action()` to establish an error
boundary, there is now a dedicated `scoped()` function which not only
traps any errors, but also creates a resource boundary that does not
let any resource or task escape.

This updates the error documentation, and also adds documentation to
the `scoped()` function. Finally, there was an old deno link that I
updated to JSR.
@cowboyd cowboyd merged commit e7510ac into v4 Jan 8, 2025
3 checks passed
@cowboyd cowboyd deleted the v4doc-errors branch January 8, 2025 16:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants