uerr

package
v1.9.0 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2020 License: AGPL-3.0 Imports: 3 Imported by: 0

Documentation

Overview

Package err define error type of uexky

Use uerr.New and uerr.Errorf to create custom errors. Use uerr.Wrap and uerr.Wrapf to wrap extern errors. To transit error in this project, just use errors.Wrap and errors.Wrapf, the wrapped message is function name and parameters. Follow this guideline, we will get clear error stack.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Wrap

func Wrap(t ErrorType, err error, a ...interface{}) error

func Wrapf

func Wrapf(t ErrorType, err error, format string, a ...interface{}) error

Types

type ErrSlice

type ErrSlice []error

func (ErrSlice) Error

func (e ErrSlice) Error() string

type Error

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

func Errorf

func Errorf(t ErrorType, format string, a ...interface{}) *Error

func New

func New(t ErrorType, a ...interface{}) *Error

func (*Error) As

func (e *Error) As(target error) bool

func (*Error) Error

func (e *Error) Error() string

func (*Error) Is

func (e *Error) Is(target error) bool

func (*Error) Unwrap

func (e *Error) Unwrap() error

type ErrorType

type ErrorType string
const (
	UnknownError    ErrorType = ""
	ParamsError     ErrorType = "ParamsError"
	AuthError       ErrorType = "AuthError"
	PermissionError ErrorType = "PermissionError"
	NotFoundError   ErrorType = "NotFoundError"
	RateLimitError  ErrorType = "RateLimitError"
	InternalError   ErrorType = "InternalError"

	// External Services
	PostgresError ErrorType = "PostgresError"
	RedisError    ErrorType = "RedisError"
	MailgunError  ErrorType = "MailgunError"
)

func ExtractErrorType

func ExtractErrorType(err error) ErrorType

func (ErrorType) Code

func (t ErrorType) Code() string

Jump to

Keyboard shortcuts

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