errors

package
v0.20.14 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2021 License: MIT Imports: 13 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidLengthErrors        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowErrors          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupErrors = fmt.Errorf("proto: unexpected end of group")
)

Functions

func Equal

func Equal(err1 error, err2 error) bool

Equal tries to compare errors

Types

type Child

type Child struct {
	Code   int32  `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty"`
	Detail string `protobuf:"bytes,2,opt,name=detail,proto3" json:"detail,omitempty"`
}

func (*Child) Descriptor

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

func (*Child) Marshal

func (m *Child) Marshal() (dAtA []byte, err error)

func (*Child) MarshalTo

func (m *Child) MarshalTo(dAtA []byte) (int, error)

func (*Child) MarshalToSizedBuffer

func (m *Child) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Child) ProtoMessage

func (*Child) ProtoMessage()

func (*Child) Reset

func (m *Child) Reset()

func (*Child) String

func (m *Child) String() string

func (*Child) Unmarshal

func (m *Child) Unmarshal(dAtA []byte) error

func (*Child) XSize added in v0.18.10

func (m *Child) XSize() (n int)

func (*Child) XXX_DiscardUnknown

func (m *Child) XXX_DiscardUnknown()

func (*Child) XXX_Marshal

func (m *Child) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Child) XXX_Merge

func (m *Child) XXX_Merge(src proto.Message)

func (*Child) XXX_Size

func (m *Child) XXX_Size() int

func (*Child) XXX_Unmarshal

func (m *Child) XXX_Unmarshal(b []byte) error

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"`
	Position string   `protobuf:"bytes,5,opt,name=position,proto3" json:"position,omitempty"`
	Child    *Child   `protobuf:"bytes,6,opt,name=child,proto3" json:"child,omitempty"`
	Stacks   []*Stack `protobuf:"bytes,7,rep,name=stacks,proto3" json:"stacks,omitempty"`
}

func BadGateway

func BadGateway(id, format string, a ...interface{}) *Error

BadGateway generates a 502 error

func BadRequest

func BadRequest(id, format string, a ...interface{}) *Error

BadRequest generates a 400 error.

func Conflict

func Conflict(id, format string, a ...interface{}) *Error

Conflict generates a 409 error.

func Forbidden

func Forbidden(id, format string, a ...interface{}) *Error

Forbidden generates a 403 error.

func FromErr

func FromErr(err error) *Error

FromErr try to convert go error go *Error

func GatewayTimeout

func GatewayTimeout(id, format string, a ...interface{}) *Error

GatewayTimeout generates a 504 error

func InternalServerError

func InternalServerError(id, format string, a ...interface{}) *Error

InternalServerError generates a 500 error.

func MethodNotAllowed

func MethodNotAllowed(id, format string, a ...interface{}) *Error

MethodNotAllowed generates a 405 error.

func New

func New(id, detail string, code int32) *Error

New generates a custom error.

func NotFound

func NotFound(id, format string, a ...interface{}) *Error

NotFound generates a 404 error.

func NotImplemented

func NotImplemented(id, format string, a ...interface{}) *Error

NotImplemented generates a 501 error

func Parse

func Parse(err string) *Error

Parse tries to parse a JSON string into an error. If that fails, it will set the given string as the error detail.

func ServiceUnavailable

func ServiceUnavailable(id, format string, a ...interface{}) *Error

ServiceUnavailable generates a 503 error

func Timeout

func Timeout(id, format string, a ...interface{}) *Error

Timeout generates a 408 error.

func Unauthorized

func Unauthorized(id, format string, a ...interface{}) *Error

Unauthorized generates a 401 error.

func (*Error) Descriptor

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

func (*Error) Error

func (e *Error) Error() string

func (*Error) Marshal

func (m *Error) Marshal() (dAtA []byte, err error)

func (*Error) MarshalTo

func (m *Error) MarshalTo(dAtA []byte) (int, error)

func (*Error) MarshalToSizedBuffer

func (m *Error) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Error) ProtoMessage

func (*Error) ProtoMessage()

func (*Error) Reset

func (m *Error) Reset()

func (*Error) String

func (m *Error) String() string

func (*Error) Unmarshal

func (m *Error) Unmarshal(dAtA []byte) error

func (*Error) WithChild

func (e *Error) WithChild(code int32, format string, a ...interface{}) *Error

WithChild fills Error.Child

func (*Error) WithPos

func (e *Error) WithPos() *Error

WithPos fills Error.Position

func (*Error) WithStack

func (e *Error) WithStack(code int32, detail string, pos ...bool) *Error

WithStack push stack information to Error

func (*Error) XSize added in v0.18.10

func (m *Error) XSize() (n int)

func (*Error) XXX_DiscardUnknown

func (m *Error) XXX_DiscardUnknown()

func (*Error) XXX_Marshal

func (m *Error) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Error) XXX_Merge

func (m *Error) XXX_Merge(src proto.Message)

func (*Error) XXX_Size

func (m *Error) XXX_Size() int

func (*Error) XXX_Unmarshal

func (m *Error) XXX_Unmarshal(b []byte) error

type Stack

type Stack struct {
	Code     int32  `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty"`
	Detail   string `protobuf:"bytes,2,opt,name=detail,proto3" json:"detail,omitempty"`
	Position string `protobuf:"bytes,3,opt,name=position,proto3" json:"position,omitempty"`
}

func (*Stack) Descriptor

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

func (*Stack) Marshal

func (m *Stack) Marshal() (dAtA []byte, err error)

func (*Stack) MarshalTo

func (m *Stack) MarshalTo(dAtA []byte) (int, error)

func (*Stack) MarshalToSizedBuffer

func (m *Stack) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Stack) ProtoMessage

func (*Stack) ProtoMessage()

func (*Stack) Reset

func (m *Stack) Reset()

func (*Stack) String

func (m *Stack) String() string

func (*Stack) Unmarshal

func (m *Stack) Unmarshal(dAtA []byte) error

func (*Stack) XSize added in v0.18.10

func (m *Stack) XSize() (n int)

func (*Stack) XXX_DiscardUnknown

func (m *Stack) XXX_DiscardUnknown()

func (*Stack) XXX_Marshal

func (m *Stack) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Stack) XXX_Merge

func (m *Stack) XXX_Merge(src proto.Message)

func (*Stack) XXX_Size

func (m *Stack) XXX_Size() int

func (*Stack) XXX_Unmarshal

func (m *Stack) XXX_Unmarshal(b []byte) error

Jump to

Keyboard shortcuts

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