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

refactor(katana): improve error handling #1415

Merged
merged 1 commit into from
Jan 12, 2024
Merged

refactor(katana): improve error handling #1415

merged 1 commit into from
Jan 12, 2024

Conversation

kariy
Copy link
Member

@kariy kariy commented Jan 11, 2024

This PR adds initial error handling improvement. The idea is to not rely on anyhow on lib level and

  • Typed error for katana-providers replacing anyhow.
  • Removed unused variants in SequencerError enum.
  • Turn UnexpectedError variant of StarknetApiError into a struct with a reason field.

@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

❗ No coverage uploaded for pull request base (dev/katana@70360e2). Click here to learn what that means.

Additional details and impacted files
@@              Coverage Diff              @@
##             dev/katana    #1415   +/-   ##
=============================================
  Coverage              ?   67.95%           
=============================================
  Files                 ?      220           
  Lines                 ?    21403           
  Branches              ?        0           
=============================================
  Hits                  ?    14544           
  Misses                ?     6859           
  Partials              ?        0           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Collaborator

@glihm glihm left a comment

Choose a reason for hiding this comment

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

Minor comment that may be addressed in subsequent iterations.

@@ -95,7 +95,7 @@ impl Backend {
);

let blockchain = Blockchain::new_from_forked(
ForkedProvider::new(provider, forked_block_num.into()),
ForkedProvider::new(provider, forked_block_num.into()).unwrap(),
Copy link
Collaborator

Choose a reason for hiding this comment

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

Would just add expect("ForkedProvider backend thread couldn't be started") or perhaps in next PRs with checking which unwrap are controlled and which are not?

Copy link
Member Author

@kariy kariy Jan 12, 2024

Choose a reason for hiding this comment

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

Good idea. I could put that in, but I want to refactor the caller function to also propagate the error.

Would do that in the next PR.

@kariy kariy merged commit 11fcd1f into dev/katana Jan 12, 2024
10 checks passed
@kariy kariy deleted the improve-error branch January 12, 2024 06:26
kariy added a commit that referenced this pull request Jan 15, 2024
@kariy kariy mentioned this pull request Jan 16, 2024
kariy added a commit that referenced this pull request Jan 17, 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.

3 participants