[DX-2128] Better error messages in Seth #2207
Draft
+854
−287
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request focuses on improving error messages and making them more actionable throughout the
sethpackage. It replaces the usage of thegithub.com/pkg/errorslibrary with Go's standardfmt.Errorf, and revises error handling to provide clearer guidance and troubleshooting steps for users. The changes affect configuration validation, contract ABI lookup, block statistics, and client initialization, making it easier for developers to diagnose and resolve common issues.Error message improvements and actionable guidance:
seth.go,abi_finder.go, andblock_stats.go. These messages now include troubleshooting steps and links to documentation or issue trackers where relevant. [1] [2] [3] [4] [5] [6]Error handling and library updates:
github.com/pkg/errorsand replaced them with standardfmt.Errorf, simplifying imports and error wrapping throughout the codebase. [1] [2] [3] [4]Client initialization and configuration validation:
NewClientWithConfig,NewClientRaw) to clarify configuration issues, RPC connectivity problems, and contract mapping errors, providing actionable next steps for users. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11]Documentation:
Below is a summarization created by an LLM (gpt-4-0125-preview). Be mindful of hallucinations and verify accuracy.
Why
This patch aims to improve error handling and messaging across the Seth library, particularly focusing on providing more actionable feedback and ensuring compatibility with updated dependencies.
What
github.com/pkg/errorswith Go's standarderrorspackage and custom error formatting to provide clearer, more actionable error messages.Specific Changes Include:
github.com/pkg/errorswith standarderrorspackage for error wrapping.