Documentation ¶
Index ¶
- Constants
- Variables
- func As(err error, target any) bool
- func Code(err error) int
- func Errorf(code int, reason string, format string, a ...any) error
- func Is(err, target error) bool
- 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
- func Unwrap(err error) error
- 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 string, format string, a ...any) *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 ¶
View Source
const ( UnknownCode = 500 UnknownReason = "" )
Variables ¶
View Source
var (
// optional int32 code = 1109;
E_Code = &file_errors_proto_extTypes[1]
)
Extension fields to descriptorpb.EnumValueOptions.
View Source
var (
// optional int32 default_code = 1108;
E_DefaultCode = &file_errors_proto_extTypes[0]
)
Extension fields to descriptorpb.EnumOptions.
View Source
var File_errors_proto protoreflect.FileDescriptor
Functions ¶
func IsBadRequest ¶
func IsClientClosed ¶
func IsConflict ¶
func IsForbidden ¶
func IsGatewayTimeout ¶
func IsInternalServer ¶
func IsNotFound ¶
func IsServiceUnavailable ¶
func IsUnauthorized ¶
Types ¶
type Error ¶
type Error struct { Status // 基本 = google.golang.org/grpc/internal/status.Status // contains filtered or unexported fields }
func BadRequest ¶
func ClientClosed ¶
func GatewayTimeout ¶
func InternalServer ¶
func ServiceUnavailable ¶
func Unauthorized ¶
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
Click to show internal directories.
Click to hide internal directories.