errorz

package
v0.0.0-...-8cfd1f9 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2022 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Builder

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

func Build

func Build(t string, code int, message ...string) Builder

func (Builder) Details

func (b Builder) Details(details interface{}) Builder

func (Builder) Err

func (b Builder) Err() *Error

func (Builder) Error

func (b Builder) Error(err error) Builder

func (Builder) Message

func (b Builder) Message(message string) Builder

func (Builder) Messagef

func (b Builder) Messagef(format string, args ...interface{}) Builder

func (Builder) Metadata

func (b Builder) Metadata(metadata Metadata) Builder

type Error

type Error struct {
	Type     string      `json:"type"`
	Code     int         `json:"code"`
	Message  string      `json:"message"`
	Details  interface{} `json:"details,omitempty"`
	Metadata Metadata    `json:"-"`
	Err      error       `json:"-"`
}

func From

func From(err error) *Error

func Internal

func Internal(err error, format string, args ...interface{}) *Error

func New

func New(t string, code int, message string, details ...interface{}) *Error

func NotFound

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

func (*Error) Error

func (e *Error) Error() string

func (*Error) Unwrap

func (e *Error) Unwrap() error

func (*Error) WithDetails

func (e *Error) WithDetails(details interface{}) *Error

func (*Error) WithError

func (e *Error) WithError(err error) *Error

func (*Error) WithMessage

func (e *Error) WithMessage(format string, args ...interface{}) *Error

func (*Error) WithMetadata

func (e *Error) WithMetadata(metadata Metadata) *Error

type Metadata

type Metadata map[string]interface{}

Jump to

Keyboard shortcuts

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