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

Failable blocks / Improve error handling #1371

Closed
MaxVerevkin opened this issue Dec 17, 2021 · 2 comments
Closed

Failable blocks / Improve error handling #1371

MaxVerevkin opened this issue Dec 17, 2021 · 2 comments
Labels
bar-failures Discussions of undesireable bar-level errors. discussion

Comments

@MaxVerevkin
Copy link
Collaborator

MaxVerevkin commented Dec 17, 2021

The use of refresh_interval_failure in #1366 made me wonder if it can be applied to other blocks in a generic way.

Here is a rough idea: when an error in a block occurs, the block's state will be set to error_state and the text will be set according to error_format. Then the block will be restarted after error_interval. Clicking on the block will show the full error message. Clicking again will hide the full error message.

There is a major issue though: some blocks spawn threads. The situation is better for async implementation, as those threads are at least abortable (edit: spawn_blocking() is not really abortable).

@MaxVerevkin
Copy link
Collaborator Author

Actually, it might be easier than I thought. There's no need to fully restart the blocks. Instead, each block can be composed of failable but recoverable parts.

As an example, here's a part of github's block from my prototype:

let total = api.recoverable(|| get_total(&request), "Oh no!").await?;

That's it. Nothing else needed on the block's side. That's how it looks:

rec.mp4

@ammgws
Copy link
Collaborator

ammgws commented Jun 19, 2022

Closing this as it's implemented in master now.

@ammgws ammgws closed this as completed Jun 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bar-failures Discussions of undesireable bar-level errors. discussion
Projects
None yet
Development

No branches or pull requests

2 participants