Documentation ¶
Overview ¶
Package goerror is a generated protocol buffer package.
It is generated from these files:
error.proto
It has these top-level messages:
DefaultError DefaultErrorList
Index ¶
- Variables
- func DefaultErrorsToErrors(berrs []*DefaultError) []error
- func PanicOnError(err error)
- type DefaultError
- func NewDefaultError(errorCode uint32, errorString string) (self *DefaultError)
- func NewDefaultErrorFromError(err error) (self *DefaultError)
- func NewDefaultErrorSprintln(errorCode uint32, a ...interface{}) (self *DefaultError)
- func NewDefaultErrorSprintlnWithFields(errorCode uint32, fields map[string]string, a ...interface{}) (self *DefaultError)
- func NewDefaultErrorWithFieldTuples(errorCode uint32, errorString string, fieldTuples ...string) (self *DefaultError)
- func (*DefaultError) Descriptor() ([]byte, []int)
- func (self *DefaultError) Error() string
- func (m *DefaultError) GetFields() map[string]string
- func (m *DefaultError) Marshal() (dAtA []byte, err error)
- func (m *DefaultError) MarshalTo(dAtA []byte) (int, error)
- func (*DefaultError) ProtoMessage()
- func (m *DefaultError) Reset()
- func (m *DefaultError) Size() (n int)
- func (m *DefaultError) String() string
- func (m *DefaultError) Unmarshal(dAtA []byte) error
- type DefaultErrorList
- func (self *DefaultErrorList) AddError(err *DefaultError)
- func (self *DefaultErrorList) AddErrorUnique(err *DefaultError) (isAdded bool)
- func (self *DefaultErrorList) AddErrors(errorList DefaultErrorList)
- func (self *DefaultErrorList) AddStdError(err error)
- func (*DefaultErrorList) Descriptor() ([]byte, []int)
- func (self *DefaultErrorList) Errors() (errorList DefaultErrorList)
- func (m *DefaultErrorList) GetList() []*DefaultError
- func (self *DefaultErrorList) HasError(err *DefaultError) bool
- func (m *DefaultErrorList) Marshal() (dAtA []byte, err error)
- func (m *DefaultErrorList) MarshalTo(dAtA []byte) (int, error)
- func (*DefaultErrorList) ProtoMessage()
- func (m *DefaultErrorList) Reset()
- func (m *DefaultErrorList) Size() (n int)
- func (m *DefaultErrorList) String() string
- func (m *DefaultErrorList) Unmarshal(dAtA []byte) error
- type DefaultErrorType
- type ErrorsProvider
Constants ¶
This section is empty.
Variables ¶
var ( ErrBusy = NewDefaultError(uint32(DefaultErrorType_BUSY), "Busy") ErrTimeout = NewDefaultError(uint32(DefaultErrorType_TIMEOUT), "Timeout") ErrInvalidMT = NewDefaultError(uint32(DefaultErrorType_INVALID_MESSAGE_TYPE), "Invalid msg type") ErrNotFoundByKey = NewDefaultError(uint32(DefaultErrorType_NOT_FOUND_BY_KEY), "Not found by key") ErrNotConnected = NewDefaultError(uint32(DefaultErrorType_NOT_CONNECTED), "Not connected") ErrFail = NewDefaultError(uint32(DefaultErrorType_FAIL), "Failed to perform action") ErrEncoding = NewDefaultError(uint32(DefaultErrorType_ENCODING), "Encoding error") ErrInvalidLength = NewDefaultError(uint32(DefaultErrorType_INVALID_LENGTH), "Invalid length error") ErrAlreadyExists = NewDefaultError(uint32(DefaultErrorType_ALREADY_EXISTS), "Already Exists error") ErrOther = NewDefaultError(uint32(DefaultErrorType_OTHER), "Other error") )
var ( ErrInvalidLengthError = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowError = fmt.Errorf("proto: integer overflow") )
var DefaultErrorType_name = map[int32]string{
0: "OTHER",
100000000: "NOT_FOUND_BY_KEY",
100000001: "INVALID_MESSAGE_TYPE",
100000002: "TIMEOUT",
100000003: "BUSY",
100000004: "NOT_CONNECTED",
100000005: "FAIL",
100000006: "ENCODING",
100000007: "INVALID_LENGTH",
100000008: "ALREADY_EXISTS",
}
var DefaultErrorType_value = map[string]int32{
"OTHER": 0,
"NOT_FOUND_BY_KEY": 100000000,
"INVALID_MESSAGE_TYPE": 100000001,
"TIMEOUT": 100000002,
"BUSY": 100000003,
"NOT_CONNECTED": 100000004,
"FAIL": 100000005,
"ENCODING": 100000006,
"INVALID_LENGTH": 100000007,
"ALREADY_EXISTS": 100000008,
}
Functions ¶
func DefaultErrorsToErrors ¶
func DefaultErrorsToErrors(berrs []*DefaultError) []error
DefaultErrorsToErrors converts a slice of DefaultErrors to a slice of type error.
Types ¶
type DefaultError ¶
type DefaultError struct { Code uint32 `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty"` Idx int32 `protobuf:"varint,2,opt,name=idx,proto3" json:"idx,omitempty"` Str string `protobuf:"bytes,3,opt,name=str,proto3" json:"str,omitempty"` Fields map[string]string `` /* 146-byte string literal not displayed */ }
DefaultError is a basic error type to be used for communication.
func NewDefaultError ¶
func NewDefaultError(errorCode uint32, errorString string) (self *DefaultError)
NewDefaultError allocates a new DefaultError with the given errorCode and errorString.
func NewDefaultErrorFromError ¶
func NewDefaultErrorFromError(err error) (self *DefaultError)
NewDefaultErrorFromError allocates a new DefaultError with its ErrorString from err.Error().
func NewDefaultErrorSprintln ¶
func NewDefaultErrorSprintln(errorCode uint32, a ...interface{}) (self *DefaultError)
NewDefaultErrorSprintln allocates a new DefaultError with the given errorCode and a as formatted string.
func NewDefaultErrorSprintlnWithFields ¶
func NewDefaultErrorSprintlnWithFields(errorCode uint32, fields map[string]string, a ...interface{}) (self *DefaultError)
NewDefaultErrorSprintln allocates a new DefaultError with the given errorCode, fields map and a as formatted string.
func NewDefaultErrorWithFieldTuples ¶
func NewDefaultErrorWithFieldTuples(errorCode uint32, errorString string, fieldTuples ...string) (self *DefaultError)
NewDefaultErrorWithFieldTuples allocates a new DefaultError with the given errorCode and errorString. Field tuples are used with the DefaultError Fields and must be a round number: .Fields[fieldTuples[i]] = fieldTuples[i+1].
func (*DefaultError) Descriptor ¶
func (*DefaultError) Descriptor() ([]byte, []int)
func (*DefaultError) Error ¶
func (self *DefaultError) Error() string
Error returns itself as formated string.
func (*DefaultError) GetFields ¶
func (m *DefaultError) GetFields() map[string]string
func (*DefaultError) Marshal ¶
func (m *DefaultError) Marshal() (dAtA []byte, err error)
func (*DefaultError) ProtoMessage ¶
func (*DefaultError) ProtoMessage()
func (*DefaultError) Reset ¶
func (m *DefaultError) Reset()
func (*DefaultError) Size ¶
func (m *DefaultError) Size() (n int)
func (*DefaultError) String ¶
func (m *DefaultError) String() string
func (*DefaultError) Unmarshal ¶
func (m *DefaultError) Unmarshal(dAtA []byte) error
type DefaultErrorList ¶
type DefaultErrorList struct {
List []*DefaultError `protobuf:"bytes,1,rep,name=list" json:"list,omitempty"`
}
DefaultErrorList is a list / slice of DefaultError.
func (*DefaultErrorList) AddError ¶
func (self *DefaultErrorList) AddError(err *DefaultError)
AddError adds an error to the underlying error list.
func (*DefaultErrorList) AddErrorUnique ¶
func (self *DefaultErrorList) AddErrorUnique(err *DefaultError) (isAdded bool)
AddError adds an error to the underlying error list if no error with the same err.Code exists.
func (*DefaultErrorList) AddErrors ¶
func (self *DefaultErrorList) AddErrors(errorList DefaultErrorList)
AddError adds all errors of errorList to the underlying error list.
func (*DefaultErrorList) AddStdError ¶
func (self *DefaultErrorList) AddStdError(err error)
AddStdError adds an error to the underlying error list.
func (*DefaultErrorList) Descriptor ¶
func (*DefaultErrorList) Descriptor() ([]byte, []int)
func (*DefaultErrorList) Errors ¶
func (self *DefaultErrorList) Errors() (errorList DefaultErrorList)
Errors returns itself.
func (*DefaultErrorList) GetList ¶
func (m *DefaultErrorList) GetList() []*DefaultError
func (*DefaultErrorList) HasError ¶
func (self *DefaultErrorList) HasError(err *DefaultError) bool
HasError tests whether an error with the same code as err.Code exists.
func (*DefaultErrorList) Marshal ¶
func (m *DefaultErrorList) Marshal() (dAtA []byte, err error)
func (*DefaultErrorList) ProtoMessage ¶
func (*DefaultErrorList) ProtoMessage()
func (*DefaultErrorList) Reset ¶
func (m *DefaultErrorList) Reset()
func (*DefaultErrorList) Size ¶
func (m *DefaultErrorList) Size() (n int)
func (*DefaultErrorList) String ¶
func (m *DefaultErrorList) String() string
func (*DefaultErrorList) Unmarshal ¶
func (m *DefaultErrorList) Unmarshal(dAtA []byte) error
type DefaultErrorType ¶
type DefaultErrorType int32
DefaultErrorType can be used as code for a DefaultError.
const ( DefaultErrorType_OTHER DefaultErrorType = 0 DefaultErrorType_NOT_FOUND_BY_KEY DefaultErrorType = 100000000 DefaultErrorType_INVALID_MESSAGE_TYPE DefaultErrorType = 100000001 DefaultErrorType_TIMEOUT DefaultErrorType = 100000002 DefaultErrorType_BUSY DefaultErrorType = 100000003 DefaultErrorType_NOT_CONNECTED DefaultErrorType = 100000004 DefaultErrorType_FAIL DefaultErrorType = 100000005 DefaultErrorType_ENCODING DefaultErrorType = 100000006 DefaultErrorType_INVALID_LENGTH DefaultErrorType = 100000007 DefaultErrorType_ALREADY_EXISTS DefaultErrorType = 100000008 )
func (DefaultErrorType) EnumDescriptor ¶
func (DefaultErrorType) EnumDescriptor() ([]byte, []int)
func (DefaultErrorType) String ¶
func (x DefaultErrorType) String() string
type ErrorsProvider ¶
type ErrorsProvider interface { AddError(err *DefaultError) AddErrorUnique(err *DefaultError) (isAdded bool) AddStdError(err error) AddErrors(errorList DefaultErrorList) HasError(err *DefaultError) bool Errors() (errorList DefaultErrorList) }
ErrorsProvider is used as a collection of DefaultErrors.