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 BadRequest(id, format string, a ...interface{}) error
- func Conflict(id, format string, a ...interface{}) error
- func Equal(err1 error, err2 error) bool
- func Forbidden(id, format string, a ...interface{}) error
- func InternalServerError(id, format string, a ...interface{}) error
- func MethodNotAllowed(id, format string, a ...interface{}) error
- func New(id, detail string, code int32) error
- func NotFound(id, format string, a ...interface{}) error
- func Timeout(id, format string, a ...interface{}) error
- func Unauthorized(id, format string, a ...interface{}) error
- type Error
- func (*Error) Descriptor() ([]byte, []int)deprecated
- func (e *Error) Error() string
- func (x *Error) GetCode() int32
- func (x *Error) GetDetail() string
- func (x *Error) GetId() 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 MultiError
- func (e *MultiError) Append(err *Error)
- func (*MultiError) Descriptor() ([]byte, []int)deprecated
- func (e *MultiError) Error() string
- func (x *MultiError) GetErrors() []*Error
- func (e *MultiError) HasErrors() bool
- func (*MultiError) ProtoMessage()
- func (x *MultiError) ProtoReflect() protoreflect.Message
- func (x *MultiError) Reset()
- func (x *MultiError) String() string
Constants ¶
This section is empty.
Variables ¶
View Source
var File_errors_proto protoreflect.FileDescriptor
Functions ¶
func BadRequest ¶
BadRequest generates a 400 error.
func InternalServerError ¶
InternalServerError generates a 500 error.
func MethodNotAllowed ¶
MethodNotAllowed generates a 405 error.
func Unauthorized ¶
Unauthorized generates a 401 error.
Types ¶
type Error ¶
type Error struct { Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` Code int32 `protobuf:"varint,2,opt,name=code,proto3" json:"code,omitempty"` Detail string `protobuf:"bytes,3,opt,name=detail,proto3" json:"detail,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) ProtoMessage ¶
func (*Error) ProtoMessage()
func (*Error) ProtoReflect ¶
func (x *Error) ProtoReflect() protoreflect.Message
type MultiError ¶
type MultiError struct { Errors []*Error `protobuf:"bytes,1,rep,name=errors,proto3" json:"errors,omitempty"` // contains filtered or unexported fields }
func NewMultiError ¶
func NewMultiError() *MultiError
func (*MultiError) Append ¶
func (e *MultiError) Append(err *Error)
func (*MultiError) Descriptor
deprecated
func (*MultiError) Descriptor() ([]byte, []int)
Deprecated: Use MultiError.ProtoReflect.Descriptor instead.
func (*MultiError) Error ¶
func (e *MultiError) Error() string
func (*MultiError) GetErrors ¶
func (x *MultiError) GetErrors() []*Error
func (*MultiError) HasErrors ¶
func (e *MultiError) HasErrors() bool
func (*MultiError) ProtoMessage ¶
func (*MultiError) ProtoMessage()
func (*MultiError) ProtoReflect ¶
func (x *MultiError) ProtoReflect() protoreflect.Message
func (*MultiError) Reset ¶
func (x *MultiError) Reset()
func (*MultiError) String ¶
func (x *MultiError) String() string
Click to show internal directories.
Click to hide internal directories.