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

chore: ensure libevm new files wrap errors with appropriate context #91

Open
qdm12 opened this issue Dec 16, 2024 · 0 comments
Open

chore: ensure libevm new files wrap errors with appropriate context #91

qdm12 opened this issue Dec 16, 2024 · 0 comments

Comments

@qdm12
Copy link
Collaborator

qdm12 commented Dec 16, 2024

Rationale

We should be able to quickly find where an error is coming from, and have a minimal context on what failed. To do so we can:

  • use fmt.Errorf("doing this: %s", err) to wrap errors coming from 'below' layers
  • use fmt.Errorf("failed this: some details context") when creating an error, with necessary details

⚠️ careful geth is not checking the error directly with == instead of errors.Is otherwise it means we cannot add error context wrapping.

Implementation

Check all *libevm* files as well as geth original source files that were modified for:

  • regex return.+err and add wrapping if appropriate
  • check other return statements in case we return the error directly without wrapping i.e. return f() where f returns an error

ℹ️ Note we obviously don't want to modify parts we did not add on top of geth and that we did not modify in geth original code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant