Documentation ¶
Overview ¶
Package errcode provides a way to return detailed information for an RPC request error. The error is normally JSON encoded.
Index ¶
- Constants
- Variables
- func Equal(err1 error, err2 error) bool
- func New(id, domain string, code ErrorCoder) error
- type ErrCode
- type Error
- func (*Error) Descriptor() ([]byte, []int)deprecated
- func (e *Error) Error() string
- func (x *Error) GetDomain() string
- func (x *Error) GetErrorCode() string
- func (x *Error) GetErrorMessage() string
- func (x *Error) GetShowType() string
- func (x *Error) GetSuccess() bool
- func (x *Error) GetTraceId() string
- func (*Error) ProtoMessage()
- func (x *Error) ProtoReflect() protoreflect.Message
- func (x *Error) Reset()
- func (x *Error) String() string
- type ErrorCoder
Constants ¶
View Source
const ( // Silent silent Silent = "0" // MessageWarn message warn MessageWarn = "1" // MessageError message error MessageError = "2" // Notification notification Notification = "4" // Page page Page = "9" )
Variables ¶
View Source
var File_errors_proto protoreflect.FileDescriptor
Functions ¶
Types ¶
type ErrCode ¶
type ErrCode int32
ErrCode error code
const ( // Success success code Success ErrCode = ok )
type Error ¶
type Error struct { // Success if request is success Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` // ErrorCode code for errorType ErrorCode string `protobuf:"bytes,2,opt,name=errorCode,proto3" json:"errorCode,omitempty"` // ErrorMessage message display to user ErrorMessage string `protobuf:"bytes,3,opt,name=errorMessage,proto3" json:"errorMessage,omitempty"` // ShowType error display type: 0 silent; 1 message.warn; 2 message.error; 4 notification; 9 page ShowType string `protobuf:"bytes,4,opt,name=showType,proto3" json:"showType,omitempty"` // TraceId Convenient for back-end Troubleshooting: unique request ID TraceId string `protobuf:"bytes,5,opt,name=traceId,proto3" json:"traceId,omitempty"` // Domain onvenient for backend Troubleshooting: host of current access server Domain string `protobuf:"bytes,6,opt,name=domain,proto3" json:"domain,omitempty"` // contains filtered or unexported fields }
func Parse ¶
Parse tries to parse a JSON string into an error. If that fails, it will set the given string as the error detail.
func (*Error) Descriptor
deprecated
func (*Error) GetErrorCode ¶
func (*Error) GetErrorMessage ¶
func (*Error) GetShowType ¶
func (*Error) GetSuccess ¶
func (*Error) GetTraceId ¶
func (*Error) ProtoMessage ¶
func (*Error) ProtoMessage()
func (*Error) ProtoReflect ¶
func (x *Error) ProtoReflect() protoreflect.Message
Click to show internal directories.
Click to hide internal directories.