-
Notifications
You must be signed in to change notification settings - Fork 614
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: use errors.New to replace fmt.Errorf with no parameters #1574
base: develop
Are you sure you want to change the base?
Conversation
Signed-off-by: RiceChuan <[email protected]>
Warning There were issues while running some tools. Please review the errors and either fix the tool’s configuration or disable the tool if it’s a critical failure. 🔧 golangci-lint (1.62.2)level=warning msg="[runner] Can't run linter goanalysis_metalinter: buildir: failed to load package : could not load export data: no export data for "scroll-tech/rollup/mock_bridge"" WalkthroughThe pull request introduces minor modifications to error handling in the Changes
Poem
Tip CodeRabbit's docstrings feature is now available as part of our Early Access Program! Simply use the command Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Outside diff range and nitpick comments (1)
rollup/internal/controller/sender/transaction_signer.go (1)
98-98
: Consider enhancing the type safety of SignerTypeWhile the change to
errors.New
is appropriate for this static message, the comment "shouldn't happen" suggests this case should be unreachable. Consider:
- Making SignerType an enumerated type (const or custom type) instead of a string
- Removing the default case entirely since types are validated during creation
- If retained for defensive programming, adding logging for this unexpected scenario
Example enhancement:
type SignerType string const ( PrivateKeySignerType SignerType = "PrivateKey" RemoteSignerType SignerType = "RemoteSigner" )
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
rollup/internal/controller/sender/transaction_signer.go
(3 hunks)
🔇 Additional comments (3)
rollup/internal/controller/sender/transaction_signer.go (3)
5-5
: LGTM: Import addition is appropriate
The addition of the "errors" import is necessary and correctly placed for the planned error handling changes.
55-55
: LGTM: Appropriate use of errors.New
The change from fmt.Errorf to errors.New is correct here as the error message is static and requires no formatting.
Line range hint 67-67
: LGTM: Correctly retained fmt.Errorf
Appropriate retention of fmt.Errorf here as the error message requires parameter formatting for the signer type.
use errors.New to replace fmt.Errorf with no parameters
Summary by CodeRabbit