1
0

Added check to only let a user delete his own list

This commit is contained in:
konrad
2018-06-12 18:35:36 +02:00
committed by kolaente
parent 5ba9d76328
commit be18247682
5 changed files with 56 additions and 9 deletions

View File

@ -155,3 +155,19 @@ func IsErrListItemCannotBeEmpty(err error) bool {
func (err ErrListItemCannotBeEmpty) Error() string {
return fmt.Sprintf("List item text cannot be empty.")
}
// ErrListItemCannotBeEmpty represents a "ErrListDoesNotExist" kind of error. Used if the list does not exist.
type ErrListItemDoesNotExist struct{
ID int64
}
// IsErrListItemCannotBeEmpty checks if an error is a ErrListDoesNotExist.
func IsErrListItemDoesNotExist(err error) bool {
_, ok := err.(ErrListItemDoesNotExist)
return ok
}
func (err ErrListItemDoesNotExist) Error() string {
return fmt.Sprintf("List item does not exist. [ID: %d]", err.ID)
}