From 6157c700dd7efc3dc6e6ffe1efb182de70c1c72e Mon Sep 17 00:00:00 2001 From: Ethan Buchman Date: Sat, 28 Apr 2018 16:15:30 -0400 Subject: [PATCH] forgot errors file --- p2p/pex/errors.go | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 p2p/pex/errors.go diff --git a/p2p/pex/errors.go b/p2p/pex/errors.go new file mode 100644 index 000000000..6d5451e3f --- /dev/null +++ b/p2p/pex/errors.go @@ -0,0 +1,41 @@ +package pex + +import ( + "fmt" + + "github.com/tendermint/tendermint/p2p" +) + +type ErrAddrBookNonRoutable struct { + Addr *p2p.NetAddress +} + +func (err ErrAddrBookNonRoutable) Error() string { + return fmt.Sprintf("Cannot add non-routable address %v", err.Addr) +} + +type ErrAddrBookSelf struct { + Addr *p2p.NetAddress +} + +func (err ErrAddrBookSelf) Error() string { + return fmt.Sprintf("Cannot add ourselves with address %v", err.Addr) +} + +type ErrAddrBookNilAddr struct { + Addr *p2p.NetAddress + Src *p2p.NetAddress +} + +func (err ErrAddrBookNilAddr) Error() string { + return fmt.Sprintf("Cannot add a nil address. Got (addr, src) = (%v, %v)", err.Addr, err.Src) +} + +type ErrAddrBookFull struct { + Addr *p2p.NetAddress + Size int +} + +func (err ErrAddrBookFull) Error() string { + return fmt.Sprintf("Can't add new address (%v), addr book is full (%d)", err.Addr, err.Size) +}