httperrors

package
v0.0.0-...-66e4c3a Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// HTTPErrorTypeGeneric represents the generic error type returned as default for all HTTP errors without a type defined.
	HTTPErrorTypeGeneric string = "generic"
)

Variables

View Source
var (
	ErrBadRequestInvalidPassword = NewHTTPErrorWithDetail(http.StatusBadRequest, "INVALID_PASSWORD", "The password provided was invalid", "Password was either too weak or did not match other criteria")
	ErrForbiddenNotLocalUser     = NewHTTPError(http.StatusForbidden, "NOT_LOCAL_USER", "User account is not valid for local authentication")
	ErrNotFoundTokenNotFound     = NewHTTPError(http.StatusNotFound, "TOKEN_NOT_FOUND", "Provided token was not found")
	ErrConflictTokenExpired      = NewHTTPError(http.StatusConflict, "TOKEN_EXPIRED", "Provided token has expired and is no longer valid")
	ErrConflictUserAlreadyExists = NewHTTPError(http.StatusConflict, "USER_ALREADY_EXISTS", "User with given username already exists")
)
View Source
var (
	ErrConflictPushToken    = NewHTTPError(http.StatusConflict, "PUSH_TOKEN_ALREADY_EXISTS", "The given token already exists.")
	ErrNotFoundOldPushToken = NewHTTPError(http.StatusNotFound, "OLD_PUSH_TOKEN_NOT_FOUND", "The old push token does not exists. The new token was saved.")
)

Functions

This section is empty.

Types

type HTTPError

type HTTPError struct {
	types.PublicHTTPError
	Internal       error                  `json:"-"`
	AdditionalData map[string]interface{} `json:"-"`
}

func ErrXRef

func ErrXRef(fileCode string, httpError *HTTPError, err error) *HTTPError

func NewHTTPError

func NewHTTPError(code int, errorType string, title string) *HTTPError

func NewHTTPErrorWithDetail

func NewHTTPErrorWithDetail(code int, errorType string, title string, detail string) *HTTPError

func (*HTTPError) Error

func (e *HTTPError) Error() string

type HTTPValidationError

type HTTPValidationError struct {
	types.PublicHTTPValidationError
	Internal       error                  `json:"-"`
	AdditionalData map[string]interface{} `json:"-"`
}

func NewHTTPValidationError

func NewHTTPValidationError(code int, errorType string, title string, validationErrors []*types.HTTPValidationErrorDetail) *HTTPValidationError

func NewHTTPValidationErrorWithDetail

func NewHTTPValidationErrorWithDetail(code int, errorType string, title string, validationErrors []*types.HTTPValidationErrorDetail, detail string) *HTTPValidationError

func (*HTTPValidationError) Error

func (e *HTTPValidationError) Error() string

Jump to

Keyboard shortcuts

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