Skip to content

Commit

Permalink
Merge pull request #35 from arkadiuszos4chain/feat-unexpected-msg-err
Browse files Browse the repository at this point in the history
feat: add typed error ErrUnhandledCmdReceived
  • Loading branch information
boecklim authored Dec 13, 2024
2 parents 08a38f5 + 46a9e13 commit 61a1165
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion wire/message.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,8 @@ type Message interface {
MaxPayloadLength(uint32) uint64
}

var ErrUnhandledCmdReceived = errors.New("unhandled command")

// makeEmptyMessage creates a message of the appropriate concrete type based
// on the command.
func makeEmptyMessage(command string) (Message, error) {
Expand Down Expand Up @@ -218,7 +220,7 @@ func makeEmptyMessage(command string) (Message, error) {
msg = &MsgSendcmpct{}

default:
return nil, fmt.Errorf("unhandled command [%s]: %#v", command, msg)
return nil, fmt.Errorf("%w [%s]", ErrUnhandledCmdReceived, command)
}
return msg, nil
}
Expand Down

0 comments on commit 61a1165

Please sign in to comment.