apply review comments
This commit is contained in:
@@ -5,7 +5,6 @@ import (
|
|||||||
|
|
||||||
validation "github.com/go-ozzo/ozzo-validation/v4"
|
validation "github.com/go-ozzo/ozzo-validation/v4"
|
||||||
"github.com/go-ozzo/ozzo-validation/v4/is"
|
"github.com/go-ozzo/ozzo-validation/v4/is"
|
||||||
merrors "github.com/micro/go-micro/v2/errors"
|
|
||||||
"github.com/owncloud/ocis-settings/pkg/proto/v0"
|
"github.com/owncloud/ocis-settings/pkg/proto/v0"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -153,7 +152,7 @@ func validateRemoveRoleFromUser(req *proto.RemoveRoleFromUserRequest) error {
|
|||||||
// validateResource is an internal helper for validating the content of a resource.
|
// validateResource is an internal helper for validating the content of a resource.
|
||||||
func validateResource(resource *proto.Resource) error {
|
func validateResource(resource *proto.Resource) error {
|
||||||
if err := validation.Validate(&resource, validation.Required); err != nil {
|
if err := validation.Validate(&resource, validation.Required); err != nil {
|
||||||
return merrors.FromError(err)
|
return err
|
||||||
}
|
}
|
||||||
if err := validation.Validate(&resource, validation.NotIn(proto.Resource_TYPE_UNKNOWN)); err != nil {
|
if err := validation.Validate(&resource, validation.NotIn(proto.Resource_TYPE_UNKNOWN)); err != nil {
|
||||||
return err
|
return err
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ import (
|
|||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/gofrs/uuid"
|
"github.com/gofrs/uuid"
|
||||||
merrors "github.com/micro/go-micro/v2/errors"
|
|
||||||
"github.com/owncloud/ocis-settings/pkg/proto/v0"
|
"github.com/owncloud/ocis-settings/pkg/proto/v0"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -23,7 +22,7 @@ func (s Store) ListBundles(bundleType proto.Bundle_Type) ([]*proto.Bundle, error
|
|||||||
bundlesFolder := s.buildFolderPathForBundles(false)
|
bundlesFolder := s.buildFolderPathForBundles(false)
|
||||||
bundleFiles, err := ioutil.ReadDir(bundlesFolder)
|
bundleFiles, err := ioutil.ReadDir(bundlesFolder)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return []*proto.Bundle{}, merrors.FromError(err)
|
return []*proto.Bundle{}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
records := make([]*proto.Bundle, 0, len(bundleFiles))
|
records := make([]*proto.Bundle, 0, len(bundleFiles))
|
||||||
@@ -74,7 +73,7 @@ func (s Store) ReadSetting(settingID string) (*proto.Setting, error) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return nil, merrors.NotFound(settingID, fmt.Sprintf("could not read setting: %v", settingID))
|
return nil, fmt.Errorf(settingID, fmt.Sprintf("could not read setting: %v", settingID))
|
||||||
}
|
}
|
||||||
|
|
||||||
// WriteBundle writes the given record into a file within the dataPath.
|
// WriteBundle writes the given record into a file within the dataPath.
|
||||||
|
|||||||
Reference in New Issue
Block a user