errors

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2021 License: GPL-3.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrInvalidStart means given start is invalid
	ErrInvalidStart = newAPPError(http.StatusBadRequest, 40000, "start is invalid")

	// ErrInvalidEnd means given end is invalid
	ErrInvalidEnd = newAPPError(http.StatusBadRequest, 40001, "end is invalid")

	// ErrInvalidN means given N is invalid
	ErrInvalidN = newAPPError(http.StatusBadRequest, 40002, "N is invalid")

	// ErrInvalidLatitude means given latitude is invalid
	ErrInvalidLatitude = newAPPError(http.StatusBadRequest, 40003, "latitude is invalid")

	// ErrInvalidLongitude means given longitude is invalid
	ErrInvalidLongitude = newAPPError(http.StatusBadRequest, 40004, "longitude is invalid")
)
View Source
var (
	// ErrCarNotExists means car not exists
	ErrCarNotExists = newAPPError(http.StatusNotFound, 40400, "car not exists")

	// ErrListCars means list cars is failure
	ErrListCars = newAPPError(http.StatusInternalServerError, 50000, "list cars is failure")
)
View Source
var (
	// ErrRateLimit means too many requests
	ErrRateLimit = newAPPError(http.StatusTooManyRequests, 42900, "too many requests")
)

Functions

This section is empty.

Types

type APPError

type APPError struct {
	Status int    `json:"-"`
	Code   int    `json:"code"`
	Msg    string `json:"msg"`
	Err    error  `json:"-"`
}

APPError declare custom error

func (*APPError) Error

func (e *APPError) Error() string

func (*APPError) WithError

func (e *APPError) WithError(err error) *APPError

WithError append error into APPError

Jump to

Keyboard shortcuts

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