Documentation
¶
Overview ¶
Package errors provides a way to return detailed information for an RPC request error. The error is normally JSON encoded.
Index ¶
- Variables
- func Equal(err1 error, err2 error) bool
- func New(id, msg string, code ErrorCoder) error
- type Error
- func (*Error) Descriptor() ([]byte, []int)deprecated
- func (e *Error) Error() string
- func (x *Error) GetCode() int32
- func (x *Error) GetMsg() string
- func (x *Error) GetRequestId() string
- func (x *Error) GetStatus() string
- func (*Error) ProtoMessage()
- func (x *Error) ProtoReflect() protoreflect.Message
- func (x *Error) Reset()
- func (x *Error) String() string
- type ErrorCode
- type ErrorCoder
Constants ¶
This section is empty.
Variables ¶
View Source
var File_errors_proto protoreflect.FileDescriptor
Functions ¶
Types ¶
type Error ¶
type Error struct { RequestId string `protobuf:"bytes,1,opt,name=requestId,proto3" json:"requestId,omitempty"` Code int32 `protobuf:"varint,2,opt,name=code,proto3" json:"code,omitempty"` Msg string `protobuf:"bytes,3,opt,name=msg,proto3" json:"msg,omitempty"` Status string `protobuf:"bytes,4,opt,name=status,proto3" json:"status,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) GetRequestId ¶
func (*Error) ProtoMessage ¶
func (*Error) ProtoMessage()
func (*Error) ProtoReflect ¶
func (x *Error) ProtoReflect() protoreflect.Message
type ErrorCode ¶
type ErrorCode int32
const ( OK ErrorCode = http.StatusOK BadRequest ErrorCode = http.StatusBadRequest Forbidden ErrorCode = http.StatusForbidden NotFound ErrorCode = http.StatusNotFound MethodNotAllowed ErrorCode = http.StatusMethodNotAllowed Timeout ErrorCode = http.StatusRequestTimeout Conflict ErrorCode = http.StatusConflict InternalServerError ErrorCode = http.StatusInternalServerError )
Click to show internal directories.
Click to hide internal directories.