apperrors

package
v0.0.0-...-bd94320 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2024 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// User alredy exists.
	ErrUserAlreadyExists = Error{
		Code:    http.StatusConflict,
		Message: "user already exists",
	}
	// Wrong credentials.
	ErrWrongCredentials = Error{
		Code:    http.StatusUnauthorized,
		Message: "wrong credentials",
	}

	// Access denied.
	ErrAccessDenied = Error{
		Code:    http.StatusForbidden,
		Message: "access denied",
	}
	// Not found.
	ErrNotFound = Error{
		Code:    http.StatusNotFound,
		Message: "not found",
	}

	// Wrong metadata.
	ErrWrongMetadata = Error{
		Code:    http.StatusBadRequest,
		Message: "wrong metadata",
	}
	// Wrong filter options.
	ErrWrongFilterOptions = Error{
		Code:    http.StatusBadRequest,
		Message: "wrong filter options",
	}
	// Unknown filter name.
	ErrUnknownFilter = Error{
		Code:    http.StatusBadRequest,
		Message: "unknown filter name",
	}
	// Invalid filter value.
	ErrInvalidFilterValue = Error{
		Code:    http.StatusBadRequest,
		Message: "invalid filter value",
	}

	// Invalid content type.
	ErrInvalidContentType = Error{
		Code:    http.StatusBadRequest,
		Message: "invalid content type",
	}
	// Invalid request body.
	ErrAuthorizationHeaderNotFound = Error{
		Code:    http.StatusUnauthorized,
		Message: "authorization header not found",
	}
	// Invalid token.
	ErrInvalidToken = Error{
		Code:    http.StatusUnauthorized,
		Message: "invalid token",
	}
)

Functions

This section is empty.

Types

type Error

type Error struct {
	Code    int
	Message string
}

Error is a custom error type. Code is an HTTP status code. Message is an error message.

func (Error) Error

func (e Error) Error() string

Error implements the error interface.

Jump to

Keyboard shortcuts

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