Documentation ¶
Overview ¶
Package errors provides a way to return detailed information for an RPC request error. The error is normally JSON encoded.
Index ¶
- 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)
- func (e *Error) Error() string
- func (m *Error) GetCode() int32
- func (m *Error) GetDetail() string
- func (m *Error) GetId() string
- func (m *Error) GetStatus() string
- func (*Error) ProtoMessage()
- func (m *Error) Reset()
- func (m *Error) String() string
- func (m *Error) XXX_DiscardUnknown()
- func (m *Error) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Error) XXX_Merge(src proto.Message)
- func (m *Error) XXX_Size() int
- func (m *Error) XXX_Unmarshal(b []byte) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BadRequest ¶
BadRequest generates a 400 error.
func Conflict ¶
Conflict generates a 409 error.
func Forbidden ¶
Forbidden generates a 403 error.
func InternalServerError ¶
InternalServerError generates a 500 error.
func MethodNotAllowed ¶
MethodNotAllowed generates a 405 error.
func NotFound ¶
NotFound generates a 404 error.
func Timeout ¶
Timeout generates a 408 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"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
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) XXX_Marshal ¶
Click to show internal directories.
Click to hide internal directories.