errorz

package
v0.17.13 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2022 License: Apache-2.0 Imports: 3 Imported by: 2

Documentation

Index

Constants

View Source
const (
	NotFoundCode    string = "NOT_FOUND"
	NotFoundMessage string = "The resource requested was not found or is no longer available"
	NotFoundStatus  int    = http.StatusNotFound

	UnhandledCode    string = "UNHANDLED"
	UnhandledMessage string = "An unhandled error occurred"
	UnhandledStatus  int    = http.StatusInternalServerError

	InvalidFieldCode    string = "INVALID_FIELD"
	InvalidFieldMessage string = "The field contains an invalid value"
	InvalidFieldStatus  int    = http.StatusBadRequest

	EntityCanNotBeDeletedCode    string = "ENTITY_CAN_NOT_BE_DELETED"
	EntityCanNotBeDeletedMessage string = "The entity requested for delete can not be deleted"
	EntityCanNotBeDeletedStatus         = http.StatusBadRequest

	EntityCanNotBeUpdatedCode    string = "ENTITY_CAN_NOT_BE_UPDATED"
	EntityCanNotBeUpdatedMessage string = "The entity requested for update can not be updated"
	EntityCanNotBeUpdatedStatus         = http.StatusBadRequest

	CouldNotValidateCode    string = "COULD_NOT_VALIDATE"
	CouldNotValidateMessage string = "The supplied request contains an invalid document or no valid accept content were available, see cause"
	CouldNotValidateStatus  int    = http.StatusBadRequest

	UnauthorizedCode    string = "UNAUTHORIZED"
	UnauthorizedMessage string = "The request could not be completed. The session is not authorized or the credentials are invalid"
	UnauthorizedStatus  int    = http.StatusUnauthorized
)
View Source
const (
	InvalidFilterCode    string = "INVALID_FILTER"
	InvalidFilterMessage string = "The filter query supplied is invalid"

	InvalidFilterStatus int = httpStatusInvalidFilter

	InvalidPaginationCode    string = "INVALID_PAGINATION"
	InvalidPaginationMessage string = "The pagination properties provided are invalid"
	InvalidPaginationStatus  int    = http.StatusBadRequest

	InvalidSortCode    string = "INVALID_SORT_IDENTIFIER"
	InvalidSortMessage string = "The sort order supplied is invalid"
	InvalidSortStatus  int    = http.StatusBadRequest
)

specific

Variables

This section is empty.

Functions

This section is empty.

Types

type ApiError added in v0.15.25

type ApiError struct {
	Code        string `json:"code"`
	Message     string `json:"message"`
	Status      int    `json:"-"`
	Cause       error  `json:"cause"`
	AppendCause bool   `json:"-"`
}

func NewCouldNotValidate added in v0.15.25

func NewCouldNotValidate(err error) *ApiError

func NewEntityCanNotBeDeleted added in v0.15.25

func NewEntityCanNotBeDeleted() *ApiError

func NewEntityCanNotBeDeletedFrom added in v0.15.26

func NewEntityCanNotBeDeletedFrom(err error) *ApiError

func NewEntityCanNotBeUpdatedFrom added in v0.15.26

func NewEntityCanNotBeUpdatedFrom(err error) *ApiError

func NewFieldApiError added in v0.15.25

func NewFieldApiError(fieldError *FieldError) *ApiError

func NewInvalidFilter added in v0.15.25

func NewInvalidFilter(cause error) *ApiError

func NewInvalidPagination added in v0.15.25

func NewInvalidPagination(err error) *ApiError

func NewInvalidSort added in v0.15.25

func NewInvalidSort(err error) *ApiError

func NewNotFound added in v0.15.25

func NewNotFound() *ApiError

func NewUnauthorized added in v0.15.25

func NewUnauthorized() *ApiError

func NewUnhandled added in v0.15.25

func NewUnhandled(cause error) *ApiError

func (ApiError) Error added in v0.15.25

func (e ApiError) Error() string

type ErrorHolder

type ErrorHolder interface {
	GetError() error
	SetError(error) bool
	HasError() bool
}

type ErrorHolderImpl

type ErrorHolderImpl struct {
	Err error
}

func (*ErrorHolderImpl) GetError

func (holder *ErrorHolderImpl) GetError() error

func (*ErrorHolderImpl) HasError

func (holder *ErrorHolderImpl) HasError() bool

func (*ErrorHolderImpl) SetError

func (holder *ErrorHolderImpl) SetError(err error) bool

type FieldError added in v0.15.25

type FieldError struct {
	Reason     string      `json:"message"`
	FieldName  string      `json:"field"`
	FieldValue interface{} `json:"value"`
}

func NewFieldError added in v0.15.25

func NewFieldError(reason, name string, value interface{}) *FieldError

func (FieldError) Error added in v0.15.25

func (fe FieldError) Error() string

type MultipleErrors added in v0.16.5

type MultipleErrors []error

func (MultipleErrors) Error added in v0.16.5

func (e MultipleErrors) Error() string

func (MultipleErrors) ToError added in v0.16.5

func (e MultipleErrors) ToError() error

Jump to

Keyboard shortcuts

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