1
0

Add task identifier (#115)

This commit is contained in:
konrad
2019-12-07 22:28:45 +00:00
parent 1a47d7d80d
commit 720df3cbed
18 changed files with 811 additions and 217 deletions

View File

@ -471,6 +471,33 @@ func (err ErrListShareDoesNotExist) HTTPError() web.HTTPError {
return web.HTTPError{HTTPCode: http.StatusNotFound, Code: ErrCodeListShareDoesNotExist, Message: "The list share does not exist."}
}
// ErrListIdentifierIsNotUnique represents a "ErrListIdentifierIsNotUnique" kind of error. Used if the provided list identifier is not unique.
type ErrListIdentifierIsNotUnique struct {
Identifier string
}
// IsErrListIdentifierIsNotUnique checks if an error is a ErrListIdentifierIsNotUnique.
func IsErrListIdentifierIsNotUnique(err error) bool {
_, ok := err.(ErrListIdentifierIsNotUnique)
return ok
}
func (err ErrListIdentifierIsNotUnique) Error() string {
return fmt.Sprintf("List identifier is not unique.")
}
// ErrCodeListIdentifierIsNotUnique holds the unique world-error code of this error
const ErrCodeListIdentifierIsNotUnique = 3007
// HTTPError holds the http error description
func (err ErrListIdentifierIsNotUnique) HTTPError() web.HTTPError {
return web.HTTPError{
HTTPCode: http.StatusBadRequest,
Code: ErrCodeListIdentifierIsNotUnique,
Message: "A list with this identifier already exists.",
}
}
// ================
// List task errors
// ================