func IsProtocolError(err error) bool {
	_, ok := err.(ProtocolError)
	return ok
}
IsProtocolError to assert if the err is ProtocolError which has TypeId() func
package perrors
import "errors"
type ProtocolError interface {
	error
	TypeId() int
}
const (
	UnknownProtocolError = 0  
	InvalidData          = 1
	NegativeSize         = 2
	SizeLimit            = 3
	BadVersion           = 4
	NotImplemented       = 5
	DepthLimit           = 6
)
var InvalidDataLength = NewProtocolErrorWithType(InvalidData, "Invalid data length")
type protocolException struct {
	typeID  int
	message string
	rawErr  error
}
func (p *protocolException) TypeId() int {
	return p.typeID
}
func (p *protocolException) String() string {
	return p.message
}
func (p *protocolException) Error() string {
	return p.message
}
func (p *protocolException) Unwrap() error {
	return p.rawErr
}
func (p *protocolException) Is(target error) bool {
	return p == target || errors.Is(p.rawErr, target)
}
func NewProtocolError(err error) error {
	if err == nil {
		return nil
	}
	if e, ok := err.(ProtocolError); ok {
		return e
	}
	return &protocolException{typeID: UnknownProtocolError, message: err.Error(), rawErr: err}
}
func NewProtocolErrorWithErrMsg(err error, errMsg string) error {
	if err == nil {
		return nil
	}
	if e, ok := err.(ProtocolError); ok {
		return e
	}
	return &protocolException{typeID: UnknownProtocolError, message: errMsg, rawErr: err}
}
func NewProtocolErrorWithMsg(errMsg string) error {
	return &protocolException{typeID: UnknownProtocolError, message: errMsg}
}
func NewProtocolErrorWithType(errType int, errMsg string) ProtocolError {
	return &protocolException{typeID: errType, message: errMsg}
}