Get() methods from all repositories now return a ErrNotFound when the id is nonexistent

This commit is contained in:
Deluan
2016-03-18 11:33:50 -04:00
parent db34122faf
commit c90a50827a
11 changed files with 70 additions and 42 deletions
+3 -2
View File
@@ -3,6 +3,7 @@ package persistence
import (
"errors"
"github.com/deluan/gosonic/domain"
"github.com/deluan/gosonic/engine"
)
@@ -33,8 +34,8 @@ func (r *propertyRepository) Get(id string) (string, error) {
func (r *propertyRepository) DefaultGet(id string, defaultValue string) (string, error) {
v, err := r.Get(id)
if v == "" {
v = defaultValue
if err == domain.ErrNotFound {
return defaultValue, nil
}
return v, err