errors

package
v1.3.16 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Code

func Code(err error) codes.Code

func IsHandledCode

func IsHandledCode(code codes.Code) bool

Types

type Error

type Error struct {
	// contains filtered or unexported fields
}

func Cast

func Cast(err error) *Error

func New

func New(code codes.Code) *Error

func NewWithSlug

func NewWithSlug(code codes.Code, slug string) *Error

func Wrap

func Wrap(err error, code codes.Code) *Error

func WrapWithSlug

func WrapWithSlug(err error, code codes.Code, slug string) *Error

func (Error) Code

func (e Error) Code() codes.Code

func (Error) Details

func (e Error) Details() []string

func (Error) Error

func (e Error) Error() string

func (Error) GRPCStatus

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

func (Error) IsHandled

func (e Error) IsHandled() bool

func (Error) Localize

func (e Error) Localize() string

func (Error) MarshalJSON

func (e Error) MarshalJSON() ([]byte, error)

func (Error) MarshalXML

func (e Error) MarshalXML(encoder *xml.Encoder, start xml.StartElement) error

func (Error) MarshalYAML

func (e Error) MarshalYAML() (any, error)

func (Error) Message

func (e Error) Message() string

func (Error) Model

func (e Error) Model() *Model

func (Error) SetLocalize

func (e Error) SetLocalize(localize string) *Error

func (Error) Slug

func (e Error) Slug() string

func (Error) StatusCode

func (e Error) StatusCode() int

func (Error) Validations added in v1.3.0

func (e Error) Validations() []*Validation

func (Error) WithDetailF

func (e Error) WithDetailF(format string, args ...any) *Error

func (Error) WithDetails

func (e Error) WithDetails(details ...string) *Error

func (Error) WithValidation added in v1.3.0

func (e Error) WithValidation(tag string, field string) *Error

func (Error) WithValidations added in v1.3.0

func (e Error) WithValidations(validations []*Validation) *Error

type Model

type Model struct {
	Code        uint32        `json:"code,omitempty" xml:"code,omitempty" yaml:"code,omitempty"`
	Message     string        `json:"message,omitempty" xml:"message,omitempty" yaml:"message,omitempty"`
	Details     []string      `json:"details,omitempty" xml:"details,omitempty" yaml:"details,omitempty"`
	Validations []*Validation `json:"validations,omitempty" xml:"validations,omitempty" yaml:"validations,omitempty"`
}

type Validation added in v1.3.0

type Validation struct {
	Tag   string `json:"tag,omitempty" xml:"tag,omitempty" yaml:"tag,omitempty"`
	Field string `json:"field,omitempty" xml:"field,omitempty" yaml:"field,omitempty"`
}

Jump to

Keyboard shortcuts

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