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. In particular core/vm should be excluded.
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
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:
fmt.Errorf("doing this: %s", err)to wrap errors coming from 'below' layersfmt.Errorf("failed this: some details context")when creating an error, with necessary details==instead oferrors.Isotherwise it means we cannot add error context wrapping. In particular core/vm should be excluded.Implementation
Check all
*libevm*files as well as geth original source files that were modified for:return.+errand add wrapping if appropriatereturnstatements in case we return the error directly without wrapping i.e.return f()wherefreturns 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