From 5146a890d1103303bf767bd0998ce637d13a09c0 Mon Sep 17 00:00:00 2001 From: Aaron Craelius Date: Tue, 9 Jul 2024 12:26:25 +0200 Subject: [PATCH] improve error messages --- x/ecocredit/base/keeper/msg_create_batch.go | 2 +- x/ecocredit/base/keeper/msg_create_or_update_application.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/x/ecocredit/base/keeper/msg_create_batch.go b/x/ecocredit/base/keeper/msg_create_batch.go index 02fbe823c4..b19fda5876 100644 --- a/x/ecocredit/base/keeper/msg_create_batch.go +++ b/x/ecocredit/base/keeper/msg_create_batch.go @@ -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 diff --git a/x/ecocredit/base/keeper/msg_create_or_update_application.go b/x/ecocredit/base/keeper/msg_create_or_update_application.go index ef8c852321..7dfbf7eb25 100644 --- a/x/ecocredit/base/keeper/msg_create_or_update_application.go +++ b/x/ecocredit/base/keeper/msg_create_or_update_application.go @@ -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) { @@ -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