github.com/KYVENetwork/cometbft/v38@v38.0.3/blocksync/errors.go (about) 1 package blocksync 2 3 import ( 4 "errors" 5 "fmt" 6 7 "github.com/cosmos/gogoproto/proto" 8 ) 9 10 var ( 11 // ErrNilMessage is returned when provided message is empty 12 ErrNilMessage = errors.New("message cannot be nil") 13 ) 14 15 // ErrInvalidBase is returned when peer informs of a status with invalid height 16 type ErrInvalidHeight struct { 17 Height int64 18 Reason string 19 } 20 21 func (e ErrInvalidHeight) Error() string { 22 return fmt.Sprintf("invalid height %v: %s", e.Height, e.Reason) 23 } 24 25 // ErrInvalidBase is returned when peer informs of a status with invalid base 26 type ErrInvalidBase struct { 27 Base int64 28 Reason string 29 } 30 31 func (e ErrInvalidBase) Error() string { 32 return fmt.Sprintf("invalid base %v: %s", e.Base, e.Reason) 33 } 34 35 type ErrUnknownMessageType struct { 36 Msg proto.Message 37 } 38 39 func (e ErrUnknownMessageType) Error() string { 40 return fmt.Sprintf("unknown message type %T", e.Msg) 41 } 42 43 type ErrReactorValidation struct { 44 Err error 45 } 46 47 func (e ErrReactorValidation) Error() string { 48 return fmt.Sprintf("reactor validation error: %v", e.Err) 49 } 50 51 func (e ErrReactorValidation) Unwrap() error { 52 return e.Err 53 }