errors

package
Version: v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2019 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EAlreadyExists

func EAlreadyExists(msg string, err error, arg ...interface{}) error

EAlreadyExists creates an error of type EAlreadyExistsl

func EBadRequest

func EBadRequest(msg string, err error, arg ...interface{}) error

EBadRequest creates an error of type BadRequest

func EInternal

func EInternal(msg string, err error, arg ...interface{}) error

EInternal creates an error of type Internal

func ENotExists

func ENotExists(msg string, err error, arg ...interface{}) error

ENotExists creates an error of type NotExist

func ENotFound

func ENotFound(msg string, err error, arg ...interface{}) error

ENotFound creates an error of type NotFound

func EUnauthorized

func EUnauthorized(msg string, err error, arg ...interface{}) error

EUnauthorized creates an error of type Unauthorized

func EValidation

func EValidation(msg string, err error, arg ...interface{}) 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 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

func (*Error) Extensions

func (e *Error) Extensions() map[string]interface{}

Extensions for graphQL extension

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"
	// BadRequest error
	BadRequest Type = "bad_request"
	// Validation error
	Validation Type = "validation"
	// AlreadyExists error
	AlreadyExists Type = "already_exists"
	// Unauthorized error
	Unauthorized Type = "unauthorized"
)

func (Type) Code

func (t Type) Code() int

Code http error code

func (Type) String

func (t Type) String() string

Source Files

Jump to

Keyboard shortcuts

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