Skip to content

Commit

Permalink
refactor: add errorlint and refactor error (#192)
Browse files Browse the repository at this point in the history
  • Loading branch information
hoank101 authored May 23, 2024
1 parent 64e444b commit 0f6c619
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
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

0 comments on commit 0f6c619

Please sign in to comment.