Documentation ¶
Overview ¶
nolint:gomnd
Index ¶
- Constants
- Variables
- func Code(err error) int
- func Errorf(code int, reason, format string, a ...interface{}) error
- func IsBadRequest(err error) bool
- func IsClientClosed(err error) bool
- func IsConflict(err error) bool
- func IsForbidden(err error) bool
- func IsGatewayTimeout(err error) bool
- func IsInternalServer(err error) bool
- func IsNotFound(err error) bool
- func IsServiceUnavailable(err error) bool
- func IsUnauthorized(err error) bool
- func Reason(err error) string
- type Error
- func BadRequest(reason, message string) *Error
- func ClientClosed(reason, message string) *Error
- func Clone(err *Error) *Error
- func Conflict(reason, message string) *Error
- func Forbidden(reason, message string) *Error
- func FromError(err error) *Error
- func GatewayTimeout(reason, message string) *Error
- func InternalServer(reason, message string) *Error
- func New(code int, reason, message string) *Error
- func Newf(code int, reason, format string, a ...interface{}) *Error
- func NotFound(reason, message string) *Error
- func ServiceUnavailable(reason, message string) *Error
- func Unauthorized(reason, message string) *Error
- type Status
- func (*Status) Descriptor() ([]byte, []int)deprecated
- func (x *Status) GetCode() int32
- func (x *Status) GetMessage() string
- func (x *Status) GetMetadata() map[string]string
- func (x *Status) GetReason() string
- func (*Status) ProtoMessage()
- func (x *Status) ProtoReflect() protoreflect.Message
- func (x *Status) Reset()
- func (x *Status) String() string
Constants ¶
const ( // UnknownCode is unknown code for error info. UnknownCode = 500 // UnknownReason is unknown reason for error info. UnknownReason = "" // SupportPackageIsVersion1 this constant should not be referenced by any other code. SupportPackageIsVersion1 = true )
Variables ¶
var (
// optional int32 code = 1109;
E_Code = &file_errors_proto_extTypes[1]
)
Extension fields to descriptorpb.EnumValueOptions.
var (
// optional int32 default_code = 1108;
E_DefaultCode = &file_errors_proto_extTypes[0]
)
Extension fields to descriptorpb.EnumOptions.
var File_errors_proto protoreflect.FileDescriptor
Functions ¶
func IsBadRequest ¶
IsBadRequest determines if err is an error which indicates a BadRequest error. It supports wrapped errors.
func IsClientClosed ¶
IsClientClosed determines if err is an error which indicates a IsClientClosed error. It supports wrapped errors.
func IsConflict ¶
IsConflict determines if err is an error which indicates a Conflict error. It supports wrapped errors.
func IsForbidden ¶
IsForbidden determines if err is an error which indicates a Forbidden error. It supports wrapped errors.
func IsGatewayTimeout ¶
IsGatewayTimeout determines if err is an error which indicates a GatewayTimeout error. It supports wrapped errors.
func IsInternalServer ¶
IsInternalServer determines if err is an error which indicates an Internal error. It supports wrapped errors.
func IsNotFound ¶
IsNotFound determines if err is an error which indicates an NotFound error. It supports wrapped errors.
func IsServiceUnavailable ¶
IsServiceUnavailable determines if err is an error which indicates an Unavailable error. It supports wrapped errors.
func IsUnauthorized ¶
IsUnauthorized determines if err is an error which indicates an Unauthorized error. It supports wrapped errors.
Types ¶
type Error ¶
type Error struct { Status // contains filtered or unexported fields }
Error is a status error.
func BadRequest ¶
BadRequest new BadRequest error that is mapped to a 400 response.
func ClientClosed ¶
ClientClosed new ClientClosed error that is mapped to an HTTP 499 response.
func GatewayTimeout ¶
GatewayTimeout new GatewayTimeout error that is mapped to an HTTP 504 response.
func InternalServer ¶
InternalServer new InternalServer error that is mapped to a 500 response.
func ServiceUnavailable ¶
ServiceUnavailable new ServiceUnavailable error that is mapped to an HTTP 503 response.
func Unauthorized ¶
Unauthorized new Unauthorized error that is mapped to a 401 response.
func (*Error) GRPCStatus ¶
GRPCStatus returns the Status represented by se.
type Status ¶
type Status struct { Code int32 `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty"` Reason string `protobuf:"bytes,2,opt,name=reason,proto3" json:"reason,omitempty"` Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` Metadata map[string]string `` /* 157-byte string literal not displayed */ // contains filtered or unexported fields }
func (*Status) Descriptor
deprecated
func (*Status) GetMessage ¶
func (*Status) GetMetadata ¶
func (*Status) ProtoMessage ¶
func (*Status) ProtoMessage()
func (*Status) ProtoReflect ¶
func (x *Status) ProtoReflect() protoreflect.Message