Documentation ¶
Index ¶
- Constants
- type ApiError
- func NewCouldNotValidate(err error) *ApiError
- func NewEntityCanNotBeDeleted() *ApiError
- func NewEntityCanNotBeDeletedFrom(err error) *ApiError
- func NewEntityCanNotBeUpdatedFrom(err error) *ApiError
- func NewFieldApiError(fieldError *FieldError) *ApiError
- func NewInvalidFilter(cause error) *ApiError
- func NewInvalidPagination(err error) *ApiError
- func NewInvalidSort(err error) *ApiError
- func NewNotFound() *ApiError
- func NewUnauthorized() *ApiError
- func NewUnhandled(cause error) *ApiError
- type ErrorHolder
- type ErrorHolderImpl
- type FieldError
- type MultipleErrors
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 )
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 ¶
type ApiError struct { Code string `json:"code"` Message string `json:"message"` Status int `json:"-"` Cause error `json:"cause"` AppendCause bool `json:"-"` }
func NewCouldNotValidate ¶
func NewEntityCanNotBeDeleted ¶
func NewEntityCanNotBeDeleted() *ApiError
func NewFieldApiError ¶
func NewFieldApiError(fieldError *FieldError) *ApiError
func NewInvalidFilter ¶
func NewInvalidPagination ¶
func NewInvalidSort ¶
func NewNotFound ¶
func NewNotFound() *ApiError
func NewUnauthorized ¶
func NewUnauthorized() *ApiError
func NewUnhandled ¶
type ErrorHolder ¶
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 ¶
type FieldError struct { Reason string `json:"message"` FieldName string `json:"field"` FieldValue interface{} `json:"value"` }
func NewFieldError ¶
func NewFieldError(reason, name string, value interface{}) *FieldError
func (FieldError) Error ¶
func (fe FieldError) Error() string
type MultipleErrors ¶
type MultipleErrors []error
func (MultipleErrors) Error ¶
func (e MultipleErrors) Error() string
func (MultipleErrors) ToError ¶
func (e MultipleErrors) ToError() error
Click to show internal directories.
Click to hide internal directories.