httpErrors

package
v0.0.0-...-e0b5030 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	BadRequest            = errors.New("Bad request")
	AlreadyExists         = errors.New("Already Existed")
	WrongCredentials      = errors.New("Wrong Credentials")
	NotFound              = errors.New("Not Found")
	NoContent             = errors.New("No Content")
	Unauthorized          = errors.New("Unauthorized")
	Forbidden             = errors.New("Forbidden")
	PermissionDenied      = errors.New("Permission Denied")
	ExpiredCSRFError      = errors.New("Expired CSRF token")
	WrongCSRFToken        = errors.New("Wrong CSRF token")
	CSRFNotPresented      = errors.New("CSRF not presented")
	NotRequiredFields     = errors.New("No such required fields")
	BadQueryParams        = errors.New("Invalid query params")
	InternalServerError   = errors.New("Internal Server Error")
	RequestTimeoutError   = errors.New("Request Timeout")
	ExistsEmailError      = errors.New("User with given email already exists")
	InvalidJWTToken       = errors.New("Invalid JWT token")
	InvalidJWTClaims      = errors.New("Invalid JWT claims")
	NotAllowedImageHeader = errors.New("Not allowed image header")
	NoCookie              = errors.New("not found cookie header")
	DuplicateResource     = errors.New("Duplicate Resource")
)

Functions

This section is empty.

Types

type ErrorCode

type ErrorCode string

func (ErrorCode) GetText

func (m ErrorCode) GetText() string

type IRestError

type IRestError interface {
	Status() int
	Code() string
	Error() string
	Text() string
}

func ErrorResponse

func ErrorResponse(err error) (IRestError, int)

func NewBadRequestError

func NewBadRequestError(err error, code string, text string) IRestError

func NewConflictError

func NewConflictError(err error, code string, text string) IRestError

func NewForbiddenError

func NewForbiddenError(err error, code string, text string) IRestError

func NewInternalServerError

func NewInternalServerError(err error, code string, text string) IRestError

func NewNoContentError

func NewNoContentError(err error, code string, text string) IRestError

func NewNotFoundError

func NewNotFoundError(err error, code string, text string) IRestError

func NewRestError

func NewRestError(status int, err error, code ErrorCode, text string) IRestError

func NewUnauthorizedError

func NewUnauthorizedError(err error, code string, text string) IRestError

type RestError

type RestError struct {
	ErrStatus  int    `json:"status"`
	ErrCode    string `json:"code"`
	ErrMessage string `json:"message"`
	ErrText    string `json:"text"`
}

func (RestError) Code

func (e RestError) Code() string

func (RestError) Error

func (e RestError) Error() string

func (RestError) Status

func (e RestError) Status() int

func (RestError) Text

func (e RestError) Text() string

Jump to

Keyboard shortcuts

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