src.dualinventive.com/go/dinet/rpc/errors.go

42 lines
1.9 KiB
Go

package rpc
import "errors"
var (
// ErrDeviceUIDTooLong is the message thrown when the device UID is too long
ErrDeviceUIDTooLong = errors.New("resulting device UID is too long")
// ErrMsgInvalidDinetrpc is the message thrown when the dinet rpc is not 1
ErrMsgInvalidDinetrpc = errors.New("invalid dinet rpc")
// ErrMsgEmptyDeviceProjectUser is the message thrown when there is no device UID, project ID or user ID in the
// message
ErrMsgEmptyDeviceProjectUser = errors.New("no device UID, project ID or user ID")
// ErrMsgInvalidDeviceUID is the message thrown when the device UID is invalid
ErrMsgInvalidDeviceUID = errors.New("invalid device uid")
// ErrMsgInvalidProjectID is the message thrown when the project ID is invalid
ErrMsgInvalidProjectID = errors.New("invalid project id")
// ErrMsgInvalidUserID is the message thrown when the user ID is invalid
ErrMsgInvalidUserID = errors.New("invalid user id")
// ErrMsgInvalidMsgID is the message thrown when the message ID is invalid
ErrMsgInvalidMsgID = errors.New("invalid message id")
// ErrMsgErrorWithOk is the message thrown when the message contains an error block, but the error is OK
ErrMsgErrorWithOk = errors.New("message contains error with ok")
// ErrMsgEmptyTime is the message thrown when the message has no time field
ErrMsgEmptyTime = errors.New("message contains no time")
// ErrMsgInvalidClassMethod is the message thrown when there is no class method field
ErrMsgInvalidClassMethod = errors.New("empty class method")
// ErrMsgNotSupported is a not supported error message
ErrMsgNotSupported = errors.New("not supported")
// ErrMsgNoData is a no data error message
ErrMsgNoData = errors.New("no data")
)
// InvalidMsgError represents a RPC message error.
type InvalidMsgError struct {
Reason error
Msg *Msg // The RPC message that contains errors
}
func (e *InvalidMsgError) Error() string {
return e.Reason.Error()
}