[DX-2128] Better error messages in Seth#2207
Draft
Tofel wants to merge 12 commits into
Draft
Conversation
0d05ec3 to
90fa726
Compare
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR focuses on improving error messages across the Seth library by replacing the github.com/pkg/errors package with Go's standard error handling (fmt.Errorf and errors package) and enhancing error messages with actionable troubleshooting guidance. The changes systematically improve user experience by providing clearer, more detailed error messages that include potential causes and solutions.
Reviewed Changes
Copilot reviewed 29 out of 29 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| seth/go.mod | Moved pkg/errors from direct to indirect dependency |
| seth/.changeset/v1.51.4.md | Added changelog entry documenting the error message improvements |
| seth/.tool-versions | Added golangci-lint version specification |
| seth/util.go | Enhanced error messages for insufficient funds with detailed balance information and actionable solutions |
| seth/tracing.go | Improved error messages for tracer initialization, trace retrieval, and call decoding with troubleshooting steps |
| seth/retry.go | Enhanced error messages for transaction retry failures and gas bumping issues |
| seth/nonce.go | Improved nonce manager error messages with configuration guidance |
| seth/keyfile.go | Enhanced error messages for key generation and fund return operations |
| seth/header_cache.go | Improved nil header error message with issue reporting guidance |
| seth/gas_adjuster.go | Enhanced gas estimation error messages with network congestion and RPC troubleshooting |
| seth/gas.go | Improved gas fee estimation error messages with actionable solutions |
| seth/decode.go | Enhanced transaction decoding error messages with detailed failure explanations |
| seth/contract_store.go | Improved ABI/BIN loading error messages with file discovery and generation guidance |
| seth/config.go | Enhanced configuration validation error messages with detailed setup instructions |
| seth/cmd/seth.go | Updated CLI error handling to use standard error wrapping |
| seth/client.go | Comprehensive error message improvements across client initialization, validation, and transaction handling |
| seth/block_stats.go | Enhanced block statistics error messages with RPC connectivity troubleshooting |
| seth/abi_finder.go | Improved ABI lookup error messages with detailed troubleshooting steps |
| seth/client_builder.go | Updated imports to use standard errors package |
| lib/utils/seth/seth.go | Enhanced Seth configuration error messages with setup guidance |
| Test files (multiple) | Updated test assertions to use Contains instead of exact string matching for improved flexibility |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.