func NewTransError(typeID int32, err error) *TransError {
	if typeID == InternalError {
		if tID, ok := err.(TypeId); ok {
			typeID = tID.TypeId()
		} else if tID, ok := err.(TypeID); ok {
			typeID = tID.TypeID()
		}
	}
	return &TransError{message: err.Error(), typeID: typeID, rawErr: err}
}
NewTransError to build TransError with typeID and rawErr.
rawErr can be used by errors.Is(target) to check err type, like read timeout.
package remote
import "errors"
const (
	UnknownApplicationException = 0
	UnknownMethod               = 1
	InvalidMessageTypeException = 2
	WrongMethodName             = 3
	BadSequenceID               = 4
	MissingResult               = 5
	InternalError               = 6
	ProtocolError               = 7
	InvalidTransform            = 8
	InvalidProtocol             = 9
	UnsupportedClientType       = 10
)
var defaultTransErrorMessage = map[int32]string{
	UnknownApplicationException: "unknown application exception",
	UnknownMethod:               "unknown method",
	InvalidMessageTypeException: "invalid message type",
	WrongMethodName:             "wrong method name",
	BadSequenceID:               "bad sequence ID",
	MissingResult:               "missing result",
	InternalError:               "unknown internal error",
	ProtocolError:               "unknown protocol error",
	InvalidTransform:            "Invalid transform",
	InvalidProtocol:             "Invalid protocol",
	UnsupportedClientType:       "Unsupported client type",
}
type TransError struct {
	message string
	typeID  int32
	rawErr  error
}
func (e TransError) Error() string {
	if e.message != "" {
		return e.message
	}
	return defaultTransErrorMessage[e.typeID]
}
func (e TransError) TypeID() int32 {
	return e.typeID
}
func (e TransError) Unwrap() error {
	return e.rawErr
}
func (e TransError) Is(target error) bool {
	return e == target || errors.Is(e.rawErr, target)
}
func NewTransErrorWithMsg(typeID int32, message string) *TransError {
	return &TransError{message: message, typeID: typeID}
}