Skip to content

Commit

Permalink
chore: uses errors.New (#7653)
Browse files Browse the repository at this point in the history
biemoh authored Dec 10, 2024
1 parent f627b43 commit bbc7b4c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions modules/apps/transfer/keeper/keeper.go
Original file line number Diff line number Diff line change
@@ -359,18 +359,18 @@ func (k Keeper) iterateForwardedPackets(ctx context.Context, cb func(packet type
// Iterator key consists of types.ForwardedPacketKey/portID/channelID/sequence
parts := strings.Split(string(iterator.Key()), "/")
if len(parts) != 4 {
panic(fmt.Errorf("key path should always have 4 elements"))
panic(errors.New("key path should always have 4 elements"))
}
if parts[0] != string(types.ForwardedPacketKey) {
panic(fmt.Errorf("key path does not start with expected prefix: %s", types.ForwardedPacketKey))
}

portID, channelID := parts[1], parts[2]
if err := host.PortIdentifierValidator(portID); err != nil {
panic(fmt.Errorf("port identifier validation failed while parsing forward key path"))
panic(errors.New("port identifier validation failed while parsing forward key path"))
}
if err := host.ChannelIdentifierValidator(channelID); err != nil {
panic(fmt.Errorf("channel identifier validation failed while parsing forward key path"))
panic(errors.New("channel identifier validation failed while parsing forward key path"))
}

forwardPacket.ForwardKey.Sequence = sdk.BigEndianToUint64([]byte(parts[3]))

0 comments on commit bbc7b4c

Please sign in to comment.