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

chore: add more linters and make changes #3256

Merged
merged 20 commits into from
Dec 12, 2022
Prev Previous commit
Next Next commit
re-add unwrap
  • Loading branch information
aljo242 committed Dec 9, 2022
commit 01fa05d22b589e6c387547c640ab8874a95e0cda
2 changes: 1 addition & 1 deletion ignite/services/network/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func (n Network) verifiedClientIDs(ctx context.Context, launchID uint64) ([]stri
},
)

if errors.Is(err, cosmoserror.ErrNotFound) {
if errors.Is(cosmoserror.Unwrap(err), cosmoserror.ErrNotFound) {
return nil, ErrObjectNotFound
} else if err != nil {
return nil, err
Expand Down
8 changes: 4 additions & 4 deletions ignite/services/network/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ func (n Node) connectionChannels(ctx context.Context, connectionID string) (chan
res, err := n.ibcChannelQuery.ConnectionChannels(ctx, &ibcchanneltypes.QueryConnectionChannelsRequest{
Connection: connectionID,
})
if errors.Is(err, cosmoserror.ErrNotFound) {
if errors.Is(cosmoserror.Unwrap(err), cosmoserror.ErrNotFound) {
return channels, nil
} else if err != nil {
return nil, err
Expand All @@ -148,7 +148,7 @@ func (n Node) clientConnections(ctx context.Context, clientID string) ([]string,
res, err := n.ibcConnQuery.ClientConnections(ctx, &ibcconntypes.QueryClientConnectionsRequest{
ClientId: clientID,
})
if errors.Is(err, cosmoserror.ErrNotFound) {
if errors.Is(cosmoserror.Unwrap(err), cosmoserror.ErrNotFound) {
return []string{}, nil
} else if err != nil {
return nil, err
Expand All @@ -170,7 +170,7 @@ func (n Node) consumerClientID(ctx context.Context) (string, error) {
res, err := n.monitoringProviderQuery.ConsumerClientID(
ctx, &monitoringptypes.QueryGetConsumerClientIDRequest{},
)
if errors.Is(err, cosmoserror.ErrNotFound) {
if errors.Is(cosmoserror.Unwrap(err), cosmoserror.ErrNotFound) {
return "", ErrObjectNotFound
} else if err != nil {
return "", err
Expand All @@ -183,7 +183,7 @@ func (n Node) connectionChannelID(ctx context.Context) (string, error) {
res, err := n.monitoringProviderQuery.ConnectionChannelID(
ctx, &monitoringptypes.QueryGetConnectionChannelIDRequest{},
)
if errors.Is(err, cosmoserror.ErrNotFound) {
if errors.Is(cosmoserror.Unwrap(err), cosmoserror.ErrNotFound) {
return "", ErrObjectNotFound
} else if err != nil {
return "", err
Expand Down
8 changes: 4 additions & 4 deletions ignite/services/network/profile.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func (n Network) CoordinatorIDByAddress(ctx context.Context, address string) (ui
},
)

if errors.Is(err, cosmoserror.ErrNotFound) {
if errors.Is(cosmoserror.Unwrap(err), cosmoserror.ErrNotFound) {
return 0, ErrObjectNotFound
} else if err != nil {
return 0, err
Expand Down Expand Up @@ -89,7 +89,7 @@ func (n Network) Coordinator(ctx context.Context, address string) (networktypes.
CoordinatorID: coordinatorID,
},
)
if errors.Is(err, cosmoserror.ErrNotFound) {
if errors.Is(cosmoserror.Unwrap(err), cosmoserror.ErrNotFound) {
return networktypes.Coordinator{}, ErrObjectNotFound
} else if err != nil {
return networktypes.Coordinator{}, err
Expand Down Expand Up @@ -133,7 +133,7 @@ func (n Network) Validator(ctx context.Context, address string) (networktypes.Va
Address: address,
},
)
if errors.Is(err, cosmoserror.ErrNotFound) {
if errors.Is(cosmoserror.Unwrap(err), cosmoserror.ErrNotFound) {
return networktypes.Validator{}, ErrObjectNotFound
} else if err != nil {
return networktypes.Validator{}, err
Expand All @@ -149,7 +149,7 @@ func (n Network) Balances(ctx context.Context, address string) (sdk.Coins, error
Address: address,
},
)
if errors.Is(err, cosmoserror.ErrNotFound) {
if errors.Is(cosmoserror.Unwrap(err), cosmoserror.ErrNotFound) {
return sdk.Coins{}, ErrObjectNotFound
} else if err != nil {
return sdk.Coins{}, err
Expand Down
2 changes: 1 addition & 1 deletion ignite/services/network/project.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func (n Network) Project(ctx context.Context, projectID uint64) (networktypes.Pr
res, err := n.campaignQuery.Campaign(ctx, &campaigntypes.QueryGetCampaignRequest{
CampaignID: projectID,
})
if errors.Is(err, cosmoserror.ErrNotFound) {
if errors.Is(cosmoserror.Unwrap(err), cosmoserror.ErrNotFound) {
return networktypes.Project{}, ErrObjectNotFound
} else if err != nil {
return networktypes.Project{}, err
Expand Down
10 changes: 5 additions & 5 deletions ignite/services/network/queries.go
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ func (n Network) MainnetAccount(
Address: address,
},
)
if errors.Is(err, cosmoserror.ErrNotFound) {
if errors.Is(cosmoserror.Unwrap(err), cosmoserror.ErrNotFound) {
return networktypes.MainnetAccount{}, ErrObjectNotFound
} else if err != nil {
return acc, err
Expand Down Expand Up @@ -244,7 +244,7 @@ func (n Network) GenesisAccount(ctx context.Context, launchID uint64, address st
LaunchID: launchID,
Address: address,
})
if errors.Is(err, cosmoserror.ErrNotFound) {
if errors.Is(cosmoserror.Unwrap(err), cosmoserror.ErrNotFound) {
return networktypes.GenesisAccount{}, ErrObjectNotFound
} else if err != nil {
return networktypes.GenesisAccount{}, err
Expand All @@ -258,7 +258,7 @@ func (n Network) VestingAccount(ctx context.Context, launchID uint64, address st
LaunchID: launchID,
Address: address,
})
if errors.Is(err, cosmoserror.ErrNotFound) {
if errors.Is(cosmoserror.Unwrap(err), cosmoserror.ErrNotFound) {
return networktypes.VestingAccount{}, ErrObjectNotFound
} else if err != nil {
return networktypes.VestingAccount{}, err
Expand All @@ -272,7 +272,7 @@ func (n Network) GenesisValidator(ctx context.Context, launchID uint64, address
LaunchID: launchID,
Address: address,
})
if errors.Is(err, cosmoserror.ErrNotFound) {
if errors.Is(cosmoserror.Unwrap(err), cosmoserror.ErrNotFound) {
return networktypes.GenesisValidator{}, ErrObjectNotFound
} else if err != nil {
return networktypes.GenesisValidator{}, err
Expand All @@ -289,7 +289,7 @@ func (n Network) ChainReward(ctx context.Context, launchID uint64) (rewardtypes.
},
)

if errors.Is(err, cosmoserror.ErrNotFound) {
if errors.Is(cosmoserror.Unwrap(err), cosmoserror.ErrNotFound) {
return rewardtypes.RewardPool{}, ErrObjectNotFound
} else if err != nil {
return rewardtypes.RewardPool{}, err
Expand Down