apierror

package
v0.0.0-...-e10dee8 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInternalServer     = errors.New("internal server error")
	ErrBadRequest         = errors.New("bad request")
	ErrUnableToCreateLink = errors.New("unable to create link")

	ErrLinkNotFound = errors.New("link not found")
	ErrURLNotValid  = errors.New("url is not valid")
)
View Source
var (
	Errors = map[error]struct {
		Code    int
		Message string
	}{
		ErrInternalServer: {
			http.StatusInternalServerError,
			ErrInternalServer.Error(),
		},
		ErrBadRequest: {
			http.StatusBadRequest,
			ErrBadRequest.Error(),
		},
		ErrUnableToCreateLink: {
			http.StatusConflict,
			ErrUnableToCreateLink.Error(),
		},
		ErrLinkNotFound: {
			http.StatusNotFound,
			ErrLinkNotFound.Error(),
		},
		ErrURLNotValid: {
			http.StatusBadRequest,
			ErrURLNotValid.Error(),
		},
	}
)

Functions

This section is empty.

Types

type APIError

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

func BadRequestError

func BadRequestError() *APIError

func InternalError

func InternalError(err error) *APIError

func NewAPIError

func NewAPIError(err, internal error) *APIError

func NotFoundError

func NotFoundError() *APIError

func (APIError) Error

func (ae APIError) Error() string

func (APIError) Unwrap

func (ae APIError) Unwrap() error

Jump to

Keyboard shortcuts

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