Skip to content

If an uncaught error happens in Scope.run(), crash the scope.#838

Merged
cowboyd merged 1 commit intov3from
scope-run-link
Nov 30, 2023
Merged

If an uncaught error happens in Scope.run(), crash the scope.#838
cowboyd merged 1 commit intov3from
scope-run-link

Conversation

@cowboyd
Copy link
Copy Markdown
Member

@cowboyd cowboyd commented Nov 29, 2023

Motivation

#836
Right now, you can drop errors on the floor if you call scope.run() and the operation fails. The error will just dissappear, which goes against the foundations of structured concurrency.

Instead, we want to force folks to deal with the error one way or the other if they don't want it to crash their stack.

Approach

This makes scope.run() behave more like spawn() where if the error is not caught it crashes its parent.

Because scopes can now crash and become totally invalid, calling Scope.run() when the scope is inactive is now an error.

@cowboyd cowboyd requested a review from neurosnap November 29, 2023 20:45
Right now, you can drop errors on the floor if you call `scope.run()`
and the operation fails. The error will just dissappear, which goes
against the foundations of structured concurrency.

Instead, we want to force folks to deal with the error one way or the
other if they don't want it to crash their stack.

This makes `scope.run()` behave more like `spawn()` where if the error
is not caught it crashes its parent.

Because scopes can now crash and become totally invalid, calling
`Scope.run()` when the scope is inactive is now an error.
@cowboyd cowboyd merged commit fab170c into v3 Nov 30, 2023
@cowboyd cowboyd deleted the scope-run-link branch November 30, 2023 15:58
taras pushed a commit that referenced this pull request Nov 12, 2025
If an uncaught error happens in Scope.run(), crash the scope.
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