errors

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2019 License: MIT Imports: 1 Imported by: 8

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EAlreadyExists

func EAlreadyExists(msg string, err error) error

EAlreadyExists creates an error of type EAlreadyExistsl

func EInternal

func EInternal(msg string, err error) error

EInternal creates an error of type Internal

func EMalformed

func EMalformed(msg string, err error) error

EMalformed creates an error of type Malformed

func ENotExists

func ENotExists(msg string, err error) error

ENotExists creates an error of type NotExist

func EValidation

func EValidation(msg string, err error) error

EValidation creates an error of type Validationn

func Is

func Is(t Type, err error) bool

Is method checks if an error is of a specific type

func IsContextError added in v1.4.1

func IsContextError(err error) error

IsContextError creates an error of type Cancelled or Deadline

func New

func New(t Type, msg string, err error) error

New creates a new error

Types

type Error

type Error struct {
	Type    Type
	Message string
	// contains filtered or unexported fields
}

Error applicational

func (*Error) Cause

func (e *Error) Cause() string

Cause of the original error

func (*Error) Error

func (e *Error) Error() string

Error message

type Type

type Type string

Type defines the type of an error

const (
	// Internal error
	Internal Type = "internal"
	// NotFound error means that a specific item does not exist
	NotFound Type = "not_found"
	// Malformed error represents data that not respect the standard format
	Malformed Type = "malformed"
	// Validation error
	Validation Type = "validation"
	// AlreadyExists error
	AlreadyExists Type = "already_exists"
	// Timeout error
	Timeout Type = "timeout"
	// Cancelled error
	Cancelled Type = "cancelled"
)

func (Type) String

func (t Type) String() string

Jump to

Keyboard shortcuts

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