Skip to content

Commit

Permalink
improve error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronc committed Jul 9, 2024
1 parent d25eebf commit 5146a89
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion x/ecocredit/base/keeper/msg_create_batch.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func (k Keeper) CreateBatch(ctx context.Context, req *types.MsgCreateBatch) (*ty

class, err := k.stateStore.ClassTable().GetById(ctx, req.ClassId)
if err != nil {
return nil, err
return nil, sdkerrors.ErrInvalidRequest.Wrapf("could not get class with id %s: %s", req.ClassId, err.Error())
}

// check if project enrollment exists
Expand Down
4 changes: 2 additions & 2 deletions x/ecocredit/base/keeper/msg_create_or_update_application.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func (k Keeper) CreateOrUpdateApplication(ctx context.Context, msg *types.MsgCre

proj, err := k.stateStore.ProjectTable().GetById(ctx, msg.ProjectId)
if err != nil {
return nil, err
return nil, sdkerrors.ErrInvalidRequest.Wrapf("unable to retrieve project with id %s: %v", msg.ProjectId, err)
}

if !bytes.Equal(proj.Admin, admin) {
Expand All @@ -29,7 +29,7 @@ func (k Keeper) CreateOrUpdateApplication(ctx context.Context, msg *types.MsgCre

class, err := k.stateStore.ClassTable().GetById(ctx, msg.ClassId)
if err != nil {
return nil, err
return nil, sdkerrors.ErrInvalidRequest.Wrapf("unable to retrieve class with id %s: %v", msg.ClassId, err)
}

action := types.EventUpdateApplication_ACTION_UPDATE
Expand Down

0 comments on commit 5146a89

Please sign in to comment.