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

fix(code quality): Remove panics from functions that return result #1013

Merged

Conversation

PatStiles
Copy link
Contributor

@PatStiles PatStiles commented Sep 18, 2024

closes #951

Removes possible panics in aligned_batcher and aligned::main.

@PatStiles PatStiles self-assigned this Sep 19, 2024
@@ -46,7 +46,7 @@ async fn main() -> Result<(), BatcherError> {
// spawn task to listening for incoming blocks
tokio::spawn({
let app = batcher.clone();
async move { app.listen_new_blocks().await.unwrap() }
async move { app.listen_new_blocks().await }
Copy link
Collaborator

Choose a reason for hiding this comment

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

This seems to ignore the errors, is that correct?

Copy link
Contributor

Choose a reason for hiding this comment

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

This change seems strange, the unwrap should stay, app can't recover from this

Copy link
Contributor

Choose a reason for hiding this comment

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

We can change it to an expect to make it more clear that we cannot recover from this

Copy link
Contributor Author

Choose a reason for hiding this comment

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

expect() added

"Failed to create wallet from anvil private key: {}",
e.to_string()
);
return Ok(());
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should the error be forwarded?

Copy link
Contributor

@MauroToscano MauroToscano Sep 23, 2024

Choose a reason for hiding this comment

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

This is already the return of the main function. Not much to do, but we could create an issue to return an Error everywhere so the application ends with an Error

@entropidelic entropidelic merged commit 9d7a2d0 into staging Sep 24, 2024
1 check passed
@entropidelic entropidelic deleted the 951-remove-panics-from-functions-that-return-result branch September 24, 2024 20:15
This was referenced Sep 30, 2024
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.

5 participants