errorx

package
v0.0.0-...-218d4e6 Latest Latest
Warning

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

Go to latest
Published: May 6, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Chain

func Chain(fns ...func() error) error

Chain runs funs one by one until an error occurred.

func NewApiBadGatewayError

func NewApiBadGatewayError(msg string) error

func NewApiBadRequestError

func NewApiBadRequestError(msg string) error

func NewApiError

func NewApiError(code int, msg string) error

func NewApiErrorWithoutMsg

func NewApiErrorWithoutMsg(code int) error

func NewApiForbiddenError

func NewApiForbiddenError(msg string) error

func NewApiInternalError

func NewApiInternalError(msg string) error

func NewApiNotFoundError

func NewApiNotFoundError(msg string) error

func NewApiUnauthorizedError

func NewApiUnauthorizedError(msg string) error

func NewCodeAbortedError

func NewCodeAbortedError(msg string) error

func NewCodeAlreadyExistsError

func NewCodeAlreadyExistsError(msg string) error

func NewCodeCanceledError

func NewCodeCanceledError(msg string) error

func NewCodeError

func NewCodeError(code int, msg string) error

func NewCodeInternalError

func NewCodeInternalError(msg string) error

func NewCodeInvalidArgumentError

func NewCodeInvalidArgumentError(msg string) error

func NewCodeNotFoundError

func NewCodeNotFoundError(msg string) error

func NewCodeUnavailableError

func NewCodeUnavailableError(msg string) error

func NewDefaultError

func NewDefaultError(msg string) error

func Wrap

func Wrap(err error, message string) error

Wrap returns an error that wraps err with given message.

func Wrapf

func Wrapf(err error, format string, args ...any) error

Wrapf returns an error that wraps err with given format and args.

Types

type ApiError

type ApiError struct {
	Code int    `json:"code"`
	Msg  string `json:"msg"`
}

func (*ApiError) Error

func (e *ApiError) Error() string

type AtomicError

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

AtomicError defines an atomic error.

func (*AtomicError) Load

func (ae *AtomicError) Load() error

Load returns the error.

func (*AtomicError) Set

func (ae *AtomicError) Set(err error)

Set sets the error.

type BatchError

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

A BatchError is an error that can hold multiple errors.

func (*BatchError) Add

func (be *BatchError) Add(errs ...error)

Add adds errs to be, nil errors are ignored.

func (*BatchError) Err

func (be *BatchError) Err() error

Err returns an error that represents all errors.

func (*BatchError) NotNil

func (be *BatchError) NotNil() bool

NotNil checks if any error inside.

type CodeError

type CodeError struct {
	Code int    `json:"code"`
	Msg  string `json:"msg"`
}

func (*CodeError) Data

func (e *CodeError) Data() *CodeErrorResponse

func (*CodeError) Error

func (e *CodeError) Error() string

type CodeErrorResponse

type CodeErrorResponse struct {
	Code int    `json:"code"`
	Msg  string `json:"msg"`
}

type SimpleMsg

type SimpleMsg struct {
	Msg string `json:"msg"`
}

Jump to

Keyboard shortcuts

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