errors

package
v0.0.0-...-ef83997 Latest Latest
Warning

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

Go to latest
Published: May 2, 2018 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package errors holds some of the defined wrappers to handle specific type of errors.

Index

Constants

View Source
const (
	ErrInternalDatabase = "database_error"
)

Constants that can be used to identify internal server errors

Variables

This section is empty.

Functions

func IsBadParameterError

func IsBadParameterError(err error) (bool, error)

IsBadParameterError returns true if the cause of the given error can be converted to an BadParameterError, which is returned as the second result.

func IsConversionError

func IsConversionError(err error) (bool, error)

IsConversionError returns true if the cause of the given error can be converted to an ConversionError, which is returned as the second result.

func IsDataConflictError

func IsDataConflictError(err error) (bool, error)

IsDataConflictError returns true if the cause of the given error can be converted to an IsDataConflictError, which is returned as the second result.

func IsForbiddenError

func IsForbiddenError(err error) (bool, error)

IsForbiddenError returns true if the cause of the given error can be converted to an ForbiddenError, which is returned as the second result.

func IsInternalError

func IsInternalError(err error) (bool, error)

IsInternalError returns true if the cause of the given error can be converted to an InternalError, which is returned as the second result.

func IsNotFoundError

func IsNotFoundError(err error) (bool, error)

IsNotFoundError returns true if the cause of the given error can be converted to an NotFoundError, which is returned as the second result.

func IsUnauthorizedError

func IsUnauthorizedError(err error) (bool, error)

IsUnauthorizedError returns true if the cause of the given error can be converted to an UnauthorizedError, which is returned as the second result.

func IsVersionConflictError

func IsVersionConflictError(err error) (bool, error)

IsVersionConflictError returns true if the cause of the given error can be converted to an VersionConflictError, which is returned as the second result.

Types

type BadParameterError

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

BadParameterError means that a parameter was not as required

func NewBadParameterError

func NewBadParameterError(param string, actual interface{}) BadParameterError

NewBadParameterError returns the custom defined error of type NewBadParameterError.

func NewBadParameterErrorFromString

func NewBadParameterErrorFromString(errMessage string) BadParameterError

NewBadParameterErrorFromString returned a pre-defined error message from a string.

func (BadParameterError) Error

func (err BadParameterError) Error() string

Error implements the error interface

func (BadParameterError) Expected

func (err BadParameterError) Expected(expexcted interface{}) BadParameterError

Expected sets the optional expectedValue parameter on the BadParameterError

type ConversionError

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

ConversionError error means something went wrong converting between different representations

func NewConversionError

func NewConversionError(msg string) ConversionError

NewConversionError returns the custom defined error of type NewConversionError.

func (ConversionError) Error

func (err ConversionError) Error() string

type DataConflictError

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

DataConflictError means that the version was not as expected in an update operation

func NewDataConflictError

func NewDataConflictError(msg string) DataConflictError

NewDataConflictError returns the custom defined error of type NewDataConflictError.

func (DataConflictError) Error

func (err DataConflictError) Error() string

type ForbiddenError

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

ForbiddenError means that the operation is forbidden

func NewForbiddenError

func NewForbiddenError(msg string) ForbiddenError

NewForbiddenError returns the custom defined error of type ForbiddenError.

func (ForbiddenError) Error

func (err ForbiddenError) Error() string

type InternalError

type InternalError struct {
	Err error
}

InternalError means that the operation failed for some internal, unexpected reason

func NewInternalError

func NewInternalError(ctx context.Context, err error) InternalError

NewInternalError returns the custom defined error of type InternalError.

func NewInternalErrorFromString

func NewInternalErrorFromString(errorMessage string) InternalError

NewInternalErrorFromString returns the custom defined error of type InternalError.

func (InternalError) Error

func (ie InternalError) Error() string

type NotFoundError

type NotFoundError struct {
	ID string
	// contains filtered or unexported fields
}

NotFoundError means the object specified for the operation does not exist

func NewNotFoundError

func NewNotFoundError(entity string, id string) NotFoundError

NewNotFoundError returns the custom defined error of type NewNotFoundError.

func NewNotFoundErrorFromString

func NewNotFoundErrorFromString(errorMessage string) NotFoundError

NewNotFoundErrorFromString returns the custom defined error of type NewNotFoundError.

func (NotFoundError) Error

func (err NotFoundError) Error() string

type UnauthorizedError

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

UnauthorizedError means that the operation is unauthorized

func NewUnauthorizedError

func NewUnauthorizedError(msg string) UnauthorizedError

NewUnauthorizedError returns the custom defined error of type UnauthorizedError.

func (UnauthorizedError) Error

func (err UnauthorizedError) Error() string

type VersionConflictError

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

VersionConflictError means that the version was not as expected in an update operation

func NewVersionConflictError

func NewVersionConflictError(msg string) VersionConflictError

NewVersionConflictError returns the custom defined error of type VersionConflictError.

func (VersionConflictError) Error

func (err VersionConflictError) Error() string

Jump to

Keyboard shortcuts

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