errors

package
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 6, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// UnknownCode is unknown code for error info.
	UnknownCode = 500
	// UnknownReason is unknown reason for error info.
	UnknownReason = ""
)

Variables

View Source
var File_errors_proto protoreflect.FileDescriptor

Functions

func As

func As(err error, target interface{}) bool

func Code

func Code(err error) int

func Is

func Is(err, target error) bool

func Unwrap added in v0.1.1

func Unwrap(err error) error

Types

type Error

type Error 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 FromError

func FromError(err error) *Error

func New added in v0.1.1

func New(code int, reason, message string) *Error

func Newf added in v0.1.1

func Newf(code int, reason, format string, a ...interface{}) *Error

func (*Error) Descriptor deprecated added in v0.1.1

func (*Error) Descriptor() ([]byte, []int)

Deprecated: Use Error.ProtoReflect.Descriptor instead.

func (*Error) Error added in v0.1.1

func (e *Error) Error() string

func (*Error) ErrorCode added in v0.1.1

func (e *Error) ErrorCode() int

func (*Error) GRPCStatus added in v0.1.1

func (e *Error) GRPCStatus() *status.Status

func (*Error) GetCode added in v0.1.1

func (e *Error) GetCode() int32

func (*Error) GetMessage added in v0.1.1

func (e *Error) GetMessage() string

func (*Error) GetMetadata added in v0.1.1

func (e *Error) GetMetadata() map[string]string

func (*Error) GetReason added in v0.1.1

func (e *Error) GetReason() string

func (*Error) ProtoMessage added in v0.1.1

func (*Error) ProtoMessage()

func (*Error) ProtoReflect added in v0.1.1

func (e *Error) ProtoReflect() protoreflect.Message

func (*Error) Reset added in v0.1.1

func (e *Error) Reset()

func (*Error) String added in v0.1.1

func (e *Error) String() string

func (*Error) WithMetadata added in v0.1.1

func (e *Error) WithMetadata(md map[string]string) *Error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL