Add some 404s

This commit is contained in:
2020-09-27 21:40:55 -06:00
parent fa330e4397
commit 15a3d293e6
2 changed files with 49 additions and 42 deletions

View File

@ -12,6 +12,8 @@ import (
"github.com/rickb777/date"
)
var ErrNotFound = errors.New("not found")
type GenString func(length int) (string, error)
type Store struct {
@ -211,8 +213,7 @@ func (s *Store) GetEventMetadata(ctx context.Context, query GetEventMetadataQuer
return GetEventMetadataResult{}, err
}
if !found {
// TODO return a constant or a specific error type for Not Found
return GetEventMetadataResult{}, errors.New("not found")
return GetEventMetadataResult{}, ErrNotFound
}
return result, nil
}
@ -246,7 +247,7 @@ func (s *Store) GetEventResponseSummary(ctx context.Context, query GetEventRespo
return GetEventResponseSummaryResult{}, err
}
if !found {
return GetEventResponseSummaryResult{}, errors.New("event not found")
return GetEventResponseSummaryResult{}, ErrNotFound
}
var result GetEventResponseSummaryResult
@ -351,8 +352,7 @@ func (s *Store) GetEventResponse(ctx context.Context, query GetEventResponseQuer
return GetEventResponseResult{}, err
}
if !found {
// TODO return a constant or typed error
return GetEventResponseResult{}, errors.New("not found")
return GetEventResponseResult{}, ErrNotFound
}
result.DateHours = make(map[date.Date]map[int]struct{})