errorHandler

package
v0.0.0-...-4cd3371 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2022 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	InternalServerError            = errors.New("Internal Server Error")
	NotFound                       = errors.New("Not Found")
	RequestTimeoutError            = errors.New("Request Timeout")
	CannotBindGivenData            = errors.New("Could not bind given data")
	ValidationError                = errors.New("Validation failed for given payload")
	UniqueError                    = errors.New("Item should be unique on database")
	Unauthorized                   = errors.New("Unauthorized")
	UnauthorizedError              = errors.New("Unauthorized")
	GivenAssociationNotFound       = errors.New("Given association not found")
	RequiredFieldError             = errors.New("Required field is missing")
	InvalidUUIDFormat              = errors.New("Invalid UUID format")
	InvalidIdentificationNumber    = errors.New("Invalid identification number")
	InvalidPhoneNumber             = errors.New("Invalid phone number")
	LocationNoAvailable            = errors.New("Location is not available")
	InvalidEnumsValue              = errors.New("Invalid enums value")
	InvalidDateTime                = errors.New("Invalid date time")
	InvalidDropOffDate             = errors.New("Drop off date must be after pick up date")
	InvalidEmail                   = errors.New("Invalid email")
	DriverAgeNotValid              = errors.New("Driver age is not valid")
	CarNotFoundError               = errors.New("Car not found")
	LocationIsNotAvailable         = errors.New("Location is not available")
	LocationNotFoundError          = errors.New("Location not found")
	OfficeNotFoundError            = errors.New("Office not found")
	DropoffOfficeNotAvailableError = errors.New("Drop off Office is not available")
	PickupOfficeNotAvailableError  = errors.New("Pick up Office is not available")
)

Functions

func ErrorResponse

func ErrorResponse(err error) (int, interface{})

Types

type RestErr

type RestErr interface {
	Status() int
	Error() string
	Causes() interface{}
}

func NewInternalServerError

func NewInternalServerError(causes interface{}) RestErr

func NewRestError

func NewRestError(status int, err string, causes interface{}) RestErr

func ParseErrors

func ParseErrors(err error) RestErr

ParseErrors Parser of error string messages returns RestError

type RestError

type RestError _type.APIErrorResponse

func (RestError) Causes

func (e RestError) Causes() interface{}

func (RestError) Error

func (e RestError) Error() string

Error Error() interface method

func (RestError) Status

func (e RestError) Status() int

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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