-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
refactor: use errors.New to replace fmt.Errorf with no parameters #20943
Conversation
Caution Review failedThe pull request is closed. WalkthroughWalkthroughThe changes involve refactoring error handling across multiple files by replacing Changes
Assessment against linked issues
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 as PR comments)
Additionally, you can add 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
Review details
Configuration used: .coderabbit.yml
Review profile: CHILL
Files selected for processing (22)
- baseapp/abci_utils.go (1 hunks)
- client/config/config.go (2 hunks)
- client/prompt_validation.go (2 hunks)
- client/pruning/main.go (2 hunks)
- client/rpc/tx.go (4 hunks)
- client/v2/autocli/flag/pubkey.go (2 hunks)
- client/v2/autocli/query.go (3 hunks)
- runtime/router.go (3 hunks)
- schema/decoding/resolver_test.go (2 hunks)
- schema/enum.go (2 hunks)
- server/util.go (1 hunks)
- store/v2/root/factory.go (3 hunks)
- telemetry/metrics.go (3 hunks)
- testutil/key.go (2 hunks)
- tools/cosmovisor/process.go (2 hunks)
- types/tx/types.go (2 hunks)
- x/auth/client/cli/query.go (6 hunks)
- x/auth/client/cli/tx_sign.go (3 hunks)
- x/authz/client/cli/tx.go (2 hunks)
- x/genutil/types/genesis.go (1 hunks)
- x/protocolpool/keeper/keeper.go (7 hunks)
- x/staking/types/authz.go (3 hunks)
Files skipped from review due to trivial changes (3)
- baseapp/abci_utils.go
- server/util.go
- tools/cosmovisor/process.go
Additional context used
Path-based instructions (19)
client/v2/autocli/flag/pubkey.go (1)
Pattern
**/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.client/prompt_validation.go (1)
Pattern
**/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.testutil/key.go (1)
Pattern
**/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.schema/enum.go (1)
Pattern
**/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.schema/decoding/resolver_test.go (2)
Pattern
**/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.
Pattern
**/*_test.go
: "Assess the unit test code assessing sufficient code coverage for the changes associated in the pull request"store/v2/root/factory.go (1)
Pattern
**/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.client/pruning/main.go (1)
Pattern
**/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.runtime/router.go (1)
Pattern
**/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.client/config/config.go (1)
Pattern
**/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.x/auth/client/cli/query.go (1)
Pattern
**/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.types/tx/types.go (1)
Pattern
**/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.client/rpc/tx.go (1)
Pattern
**/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.x/genutil/types/genesis.go (1)
Pattern
**/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.client/v2/autocli/query.go (1)
Pattern
**/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.x/staking/types/authz.go (1)
Pattern
**/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.telemetry/metrics.go (1)
Pattern
**/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.x/authz/client/cli/tx.go (1)
Pattern
**/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.x/auth/client/cli/tx_sign.go (1)
Pattern
**/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.x/protocolpool/keeper/keeper.go (1)
Pattern
**/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.
Additional comments not posted (59)
client/v2/autocli/flag/pubkey.go (1)
51-51
: LGTM!The change from
fmt.Errorf
toerrors.New
is correct and improves consistency.client/prompt_validation.go (1)
15-15
: LGTM!The change from
fmt.Errorf
toerrors.New
is correct and improves consistency.testutil/key.go (2)
50-50
: LGTM!The change from
fmt.Errorf
toerrors.New
is correct and improves consistency.
55-55
: LGTM!The change from
fmt.Errorf
toerrors.New
is correct and improves consistency.schema/enum.go (1)
28-28
: LGTM!The change from
fmt.Errorf
toerrors.New
is correct and improves consistency.schema/decoding/resolver_test.go (2)
4-4
: LGTM!The import of
errors
is correct and necessary for the change.
108-108
: LGTM!The change from
fmt.Errorf
toerrors.New
is correct and simplifies the error creation.store/v2/root/factory.go (3)
4-4
: LGTM!The import of
errors
is correct and necessary for the change.
80-80
: LGTM!The change from
fmt.Errorf
toerrors.New
is correct and simplifies the error creation for unsupportedrocksdb
.
114-114
: LGTM!The change from
fmt.Errorf
toerrors.New
is correct and simplifies the error creation for unsupportediavl v2
.client/pruning/main.go (2)
4-4
: LGTM!The import of
errors
is correct and necessary for the change.
80-80
: LGTM!The change from
fmt.Errorf
toerrors.New
is correct and simplifies the error creation for unsupported pruning.runtime/router.go (3)
5-5
: LGTM!The import of
errors
is correct and necessary for the change.
35-35
: LGTM!The change from
fmt.Errorf
toerrors.New
is correct and simplifies the error creation for missing type URLs.
98-98
: LGTM!The change from
fmt.Errorf
toerrors.New
is correct and simplifies the error creation for missing type URLs.client/config/config.go (2)
5-5
: Importerrors
package.The import of the
errors
package is necessary for the refactoring.
72-72
: Refactor: Useerrors.New
instead offmt.Errorf
.The change correctly replaces
fmt.Errorf
witherrors.New
since no formatting is needed.x/auth/client/cli/query.go (7)
4-4
: Importerrors
package.The import of the
errors
package is necessary for the refactoring.
105-105
: Refactor: Useerrors.New
instead offmt.Errorf
.The change correctly replaces
fmt.Errorf("argument should be a tx hash")
witherrors.New("argument should be a tx hash")
since no formatting is needed.
139-139
: Refactor: Useerrors.New
instead offmt.Errorf
.The change correctly replaces
fmt.Errorf("found no txs matching given signatures")
witherrors.New("found no txs matching given signatures")
since no formatting is needed.
144-144
: Usesdkerrors.ErrLogic.Wrapf
for specific error.The use of
sdkerrors.ErrLogic.Wrapf
is appropriate for wrapping logic errors.
151-151
: Refactor: Useerrors.New
instead offmt.Errorf
.The change correctly replaces
fmt.Errorf("
acc_seqtype takes an argument '<addr>/<seq>'")
witherrors.New("
acc_seqtype takes an argument '<addr>/<seq>'")
since no formatting is needed.
162-162
: Refactor: Useerrors.New
instead offmt.Errorf
.The change correctly replaces
fmt.Errorf("found no txs matching given address and sequence combination")
witherrors.New("found no txs matching given address and sequence combination")
since no formatting is needed.
187-187
: Refactor: Useerrors.New
instead offmt.Errorf
.The change correctly replaces
fmt.Errorf("argument should be comma-separated signatures")
witherrors.New("argument should be comma-separated signatures")
since no formatting is needed.types/tx/types.go (5)
4-4
: Importerrors
package.The import of the
errors
package is necessary for the refactoring.
43-43
: Refactor: Useerrors.New
instead offmt.Errorf
.The change correctly replaces
fmt.Errorf("bad Tx")
witherrors.New("bad Tx")
since no formatting is needed.
48-48
: Refactor: Useerrors.New
instead offmt.Errorf
.The change correctly replaces
fmt.Errorf("missing TxBody")
witherrors.New("missing TxBody")
since no formatting is needed.
53-53
: Refactor: Useerrors.New
instead offmt.Errorf
.The change correctly replaces
fmt.Errorf("missing AuthInfo")
witherrors.New("missing AuthInfo")
since no formatting is needed.
58-58
: Refactor: Useerrors.New
instead offmt.Errorf
.The change correctly replaces
fmt.Errorf("missing fee")
witherrors.New("missing fee")
since no formatting is needed.client/rpc/tx.go (2)
7-7
: Importerrors
package.The import of the
errors
package is necessary for the refactoring.
226-226
: Refactor: Useerrors.New
instead offmt.Errorf
.The change correctly replaces
fmt.Errorf("txhash not found")
witherrors.New("txhash not found")
since no formatting is needed.x/genutil/types/genesis.go (1)
212-212
: Replacefmt.Errorf
witherrors.New
The
fmt.Errorf
is replaced witherrors.New
for better consistency and clarity. The change is correct and aligns with the PR objectives.client/v2/autocli/query.go (5)
5-5
: Add missing import forerrors
packageThe
errors
package is imported to replacefmt.Errorf
witherrors.New
. This change is necessary for the new error handling approach.
180-180
: Replacefmt.Errorf
witherrors.New
The
fmt.Errorf
is replaced witherrors.New
for better consistency and clarity. The change is correct and aligns with the PR objectives.
187-187
: Replacefmt.Errorf
witherrors.New
The
fmt.Errorf
is replaced witherrors.New
for better consistency and clarity. The change is correct and aligns with the PR objectives.
203-203
: Replacefmt.Errorf
witherrors.New
The
fmt.Errorf
is replaced witherrors.New
for better consistency and clarity. The change is correct and aligns with the PR objectives.
210-210
: Replacefmt.Errorf
witherrors.New
The
fmt.Errorf
is replaced witherrors.New
for better consistency and clarity. The change is correct and aligns with the PR objectives.x/staking/types/authz.go (4)
5-5
: Add missing import forerrors
packageThe
errors
package is imported to replacefmt.Errorf
witherrors.New
. This change is necessary for the new error handling approach.
67-68
: Replacefmt.Errorf
witherrors.New
The
fmt.Errorf
is replaced witherrors.New
wrapped byerrorsmod.Wrapf
for better consistency and clarity. The change is correct and aligns with the PR objectives.
72-72
: Replacefmt.Errorf
witherrors.New
The
fmt.Errorf
is replaced witherrors.New
for better consistency and clarity. The change is correct and aligns with the PR objectives.
223-224
: Replacefmt.Errorf
witherrors.New
The
fmt.Errorf
is replaced witherrors.New
wrapped byerrorsmod.Wrapf
for better consistency and clarity. The change is correct and aligns with the PR objectives.telemetry/metrics.go (3)
6-6
: Add missing import forerrors
packageThe
errors
package is imported to replacefmt.Errorf
witherrors.New
. This change is necessary for the new error handling approach.
196-196
: Replacefmt.Errorf
witherrors.New
The
fmt.Errorf
is replaced witherrors.New
for better consistency and clarity. The change is correct and aligns with the PR objectives.
222-222
: Replacefmt.Errorf
witherrors.New
The
fmt.Errorf
is replaced witherrors.New
for better consistency and clarity. The change is correct and aligns with the PR objectives.x/authz/client/cli/tx.go (1)
140-140
: LGTM! Consistent use oferrors.New
.The change from
fmt.Errorf
toerrors.New
improves consistency in error handling.x/auth/client/cli/tx_sign.go (2)
261-261
: LGTM! Consistent use oferrors.New
.The change from
fmt.Errorf
toerrors.New
improves consistency in error handling.
453-453
: LGTM! Consistent use oferrors.New
.The change from
fmt.Errorf
toerrors.New
improves consistency in error handling.x/protocolpool/keeper/keeper.go (12)
199-199
: LGTM! Consistent use oferrors.New
.The change from
fmt.Errorf
toerrors.New
improves consistency in error handling.
275-275
: LGTM! Consistent use oferrors.New
.The change from
fmt.Errorf
toerrors.New
improves consistency in error handling.
359-359
: LGTM! Consistent use oferrors.New
.The change from
fmt.Errorf
toerrors.New
improves consistency in error handling.
377-377
: LGTM! Consistent use oferrors.New
.The change from
fmt.Errorf
toerrors.New
improves consistency in error handling.
418-418
: LGTM! Consistent use oferrors.New
.The change from
fmt.Errorf
toerrors.New
improves consistency in error handling.
431-431
: LGTM! Consistent use oferrors.New
.The change from
fmt.Errorf
toerrors.New
improves consistency in error handling.
435-435
: LGTM! Consistent use oferrors.New
.The change from
fmt.Errorf
toerrors.New
improves consistency in error handling.
439-439
: LGTM! Consistent use oferrors.New
.The change from
fmt.Errorf
toerrors.New
improves consistency in error handling.
458-458
: LGTM! Consistent use oferrors.New
.The change from
fmt.Errorf
toerrors.New
improves consistency in error handling.
461-461
: LGTM! Consistent use oferrors.New
.The change from
fmt.Errorf
toerrors.New
improves consistency in error handling.
464-464
: LGTM! Consistent use oferrors.New
.The change from
fmt.Errorf
toerrors.New
improves consistency in error handling.
470-470
: LGTM! Consistent use oferrors.New
.The change from
fmt.Errorf
toerrors.New
improves consistency in error handling.
Hey thanks for opening this or again. I'll sit down on Monday to see what's going on. Thank you for sticking with it |
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.
lgtm! could you revert cosmovisor and store/v2 to see if ci passes?
looks like it upsets golangci-lint
I just happened to have some time recently, and the content is relatively simple. Have a nice weekend |
Ok, thanks for the tip, I'll try it. |
Description
Closes: #20608
Summary by CodeRabbit
fmt.Errorf
witherrors.New
across multiple functions and files.