Skip to content

Commit

Permalink
fix(dymns): replace incorrect usage of ErrInternal (#1628)
Browse files Browse the repository at this point in the history
  • Loading branch information
VictorTrustyDev authored Dec 7, 2024
1 parent 240c85e commit 0a5b253
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions x/dymns/keeper/hooks.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func (h rollappHooks) RollappCreated(ctx sdk.Context, rollappID, alias string, c

err := h.Keeper.registerAliasForRollApp(ctx, rollappID, creatorAddr, alias, aliasCost)
if err != nil {
return errorsmod.Wrap(errors.Join(gerrc.ErrInternal, err), "register alias for RollApp")
return errorsmod.Wrap(errors.Join(gerrc.ErrUnknown, err), "register alias for RollApp")
}

return nil
Expand Down Expand Up @@ -130,7 +130,7 @@ func (h rollappHooks) OnRollAppIdChanged(ctx sdk.Context, previousRollAppId, new

for _, alias := range aliasesLinkedToPreviousRollApp {
if err := h.MoveAliasToRollAppId(ctx, previousRollAppId, alias, newRollAppId); err != nil {
return errorsmod.Wrapf(errors.Join(gerrc.ErrInternal, err), "failed to migrate alias: %s", alias)
return errorsmod.Wrapf(errors.Join(gerrc.ErrUnknown, err), "failed to migrate alias: %s", alias)
}
}

Expand All @@ -147,7 +147,7 @@ func (h rollappHooks) OnRollAppIdChanged(ctx sdk.Context, previousRollAppId, new
}

if err := h.migrateChainIdsInDymNames(ctx, previousChainIdsToNewChainId); err != nil {
return errorsmod.Wrapf(errors.Join(gerrc.ErrInternal, err), "failed to migrate chain-ids in Dym-Names")
return errorsmod.Wrapf(errors.Join(gerrc.ErrUnknown, err), "failed to migrate chain-ids in Dym-Names")
}

return nil
Expand Down
4 changes: 2 additions & 2 deletions x/dymns/keeper/msg_server_register_alias.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func (k msgServer) RegisterAlias(goCtx context.Context, msg *dymnstypes.MsgRegis
sdk.NewCoins(registrationCost),
); err != nil {
return nil, errorsmod.Wrap(
errors.Join(gerrc.ErrInternal, err), "failed to register alias for RollApp",
errors.Join(gerrc.ErrUnknown, err), "failed to register alias for RollApp",
)
}

Expand Down Expand Up @@ -92,7 +92,7 @@ func (k Keeper) registerAliasForRollApp(
}

if err := k.SetAliasForRollAppId(ctx, rollAppId, alias); err != nil {
return errorsmod.Wrap(gerrc.ErrInternal, "failed to set alias for RollApp")
return errorsmod.Wrap(gerrc.ErrUnknown, "failed to set alias for RollApp")
}

ctx.EventManager().EmitEvent(sdk.NewEvent(
Expand Down
6 changes: 3 additions & 3 deletions x/dymns/keeper/proposal.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ func (k Keeper) migrateChainIdsInParams(ctx sdk.Context, previousChainIdsToNewCh
}

if err := k.SetParams(ctx, params); err != nil {
return errorsmod.Wrapf(errors.Join(gerrc.ErrInternal, err), "failed to update params")
return errorsmod.Wrapf(errors.Join(gerrc.ErrUnknown, err), "failed to update params")
}

return nil
Expand Down Expand Up @@ -127,7 +127,7 @@ func (k Keeper) migrateChainIdsInDymNames(ctx sdk.Context, previousChainIdsToNew

if err := k.SetDymName(ctx, dymName); err != nil {
return errorsmod.Wrapf(
errors.Join(gerrc.ErrInternal, err),
errors.Join(gerrc.ErrUnknown, err),
"failed to migrate chain ids for Dym-Name: %s", dymName.Name,
)
}
Expand Down Expand Up @@ -212,7 +212,7 @@ func (k Keeper) UpdateAliases(ctx sdk.Context, add, remove []dymnstypes.UpdateAl
params.Chains.AliasesOfChainIds = newAliasesOfChainIds

if err := k.SetParams(ctx, params); err != nil {
return errorsmod.Wrap(errors.Join(gerrc.ErrInternal, err), "failed to update params")
return errorsmod.Wrap(errors.Join(gerrc.ErrUnknown, err), "failed to update params")
}

return nil
Expand Down

0 comments on commit 0a5b253

Please sign in to comment.