errors

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2022 License: MPL-2.0 Imports: 0 Imported by: 0

README

Errors

errors package serve to build an arbitrary long error chain in order to capture errors returned from nested service calls.

errors package contains the custom Go error interface implementation, Error. You use the Error interface to ** wrap** two errors in a containing error as well as to test recursively if a given error contains some other error.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrUnsupportedContentType indicates unacceptable or lack of Content-Type
	ErrUnsupportedContentType = New("unsupported content type")

	// ErrInvalidQueryParams indicates invalid query parameters
	ErrInvalidQueryParams = New("invalid query parameters")

	// ErrNotFoundParam indicates that the parameter was not found in the query
	ErrNotFoundParam = New("parameter not found in the query")

	// ErrMalformedEntity indicates a malformed entity specification
	ErrMalformedEntity = New("malformed entity specification")

	// ErrNotFound indicates a non-existent entity request.
	ErrNotFound = New("non-existent entity")

	// ErrConflict indicates that entity already exists.
	ErrConflict = New("entity already exists")

	// ErrUpdateEntity indicates error in updating entity or entities
	ErrUpdateEntity = New("update entity failed")

	// ErrViewEntity indicates error in viewing entity or entities
	ErrViewEntity = New("view entity failed")

	// ErrUnauthorizedAccess indicates missing or invalid credentials provided
	// when accessing a protected resource.
	ErrUnauthorizedAccess = New("missing or invalid credentials provided")

	// ErrScanMetadata indicates problem with metadata in db.
	ErrScanMetadata = New("failed to scan metadata")

	// ErrSelectEntity indicates error while reading entity from database
	ErrSelectEntity = New("select entity from db error")
)

Functions

func Contains

func Contains(e1 error, e2 error) bool

Contains inspects if e2 error is contained in any layer of e1 error

func Wrap

func Wrap(wrapper error, err error) error

Wrap returns an Error that wrap err with wrapper

Types

type Error

type Error interface {

	// Error implements the error interface.
	Error() string

	// Msg returns error message
	Msg() string

	// Err returns wrapped error
	Err() Error
}

Error specifies an API that must be fullfiled by error type

func New

func New(text string) Error

New returns an Error that formats as the given text.

Jump to

Keyboard shortcuts

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