Skip to content
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: add errorlint and refactor error #192

Merged
merged 1 commit into from
May 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ linters:
enable:
- exportloopref
- errcheck
- errorlint
- gci
- gocritic
- gofumpt
Expand Down
2 changes: 1 addition & 1 deletion app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -721,7 +721,7 @@ func NewFeeAbs(
},
)
if err != nil {
panic(fmt.Errorf("failed to create AnteHandler: %s", err))
panic(fmt.Errorf("failed to create AnteHandler: %w", err))
}

app.SetAnteHandler(anteHandler)
Expand Down
7 changes: 4 additions & 3 deletions cmd/feeappd/main.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package main

import (
"errors"
"os"

"github.com/cosmos/cosmos-sdk/server"
Expand All @@ -16,10 +17,10 @@ func main() {
rootCmd, _ := cmd.NewRootCmd()

if err := svrcmd.Execute(rootCmd, "", app.DefaultNodeHome); err != nil {
switch e := err.(type) {
case server.ErrorCode:
var e server.ErrorCode
switch {
case errors.As(err, &e):
os.Exit(e.Code)

default:
os.Exit(1)
}
Expand Down
2 changes: 1 addition & 1 deletion x/feeabs/types/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func DefaultGenesis() *GenesisState {
func (gs GenesisState) Validate() error {
err := gs.Params.Validate()
if err != nil {
return fmt.Errorf("invalid params %s", err)
return fmt.Errorf("invalid params %w", err)
}

// Validate epochs genesis
Expand Down
Loading