1
0

when ID = 0 is passed to a 'GetSthByID'-function, it now returns a 'not exist' error

This commit is contained in:
kolaente
2018-09-13 20:07:11 +02:00
parent 716b06feff
commit 382daac0dd
9 changed files with 25 additions and 9 deletions

View File

@ -75,6 +75,10 @@ func GetTasksByListID(listID int64) (tasks []*ListTask, err error) {
// GetListTaskByID returns all tasks a list has
func GetListTaskByID(listTaskID int64) (listTask ListTask, err error) {
if listTaskID < 1 {
return ListTask{}, ErrListTaskDoesNotExist{listTaskID}
}
exists, err := x.ID(listTaskID).Get(&listTask)
if err != nil {
return ListTask{}, err