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

Use anyhow for error handling #11

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

cchudant
Copy link
Member

@cchudant cchudant commented Sep 5, 2024

Replace all error handling with anyhow

I am debugging the madara <=> madara bootstrapper integration and ran into some errors that looked like this

thread 'main' panicked at src/contract_clients/config.rs:29:10:
called `Result::unwrap()` on an `Err` value: UrlParser
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

which were hard to debug, so I moved the entire crate to anyhow.

Now it's more like this

Error: Initializing client config

Caused by:
    0: Creating the Ethereum RPC client
    1: Failed to parse URL

with each layers adding more context to the errors.

A lot of the error handling here, especially the add to json errors and wait for transaction stuff are very very redundant though - but i think this needs a deeper refactoring than the surface level stuff I just did here.

@cchudant
Copy link
Member Author

cchudant commented Sep 5, 2024

also the unwrap count is now 0 🥳

@Mohiiit Mohiiit changed the base branch from main to dev September 25, 2024 12:44
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.

1 participant