Unexport NewNotFoundError

This commit is contained in:
Cody Soyland 2018-07-05 21:48:52 -05:00
parent 92d521912e
commit 4aa8a41fa0
4 changed files with 10 additions and 10 deletions

12
api.go
View file

@ -205,7 +205,7 @@ func (api *API) Index(ctx context.Context, indexName string) (*Index, error) {
index := api.holder.Index(indexName)
if index == nil {
return nil, NewNotFoundError(ErrIndexNotFound)
return nil, newNotFoundError(ErrIndexNotFound)
}
return index, nil
}
@ -255,7 +255,7 @@ func (api *API) CreateField(ctx context.Context, indexName string, fieldName str
// Find index.
index := api.holder.Index(indexName)
if index == nil {
return nil, NewNotFoundError(ErrIndexNotFound)
return nil, newNotFoundError(ErrIndexNotFound)
}
// Create field.
@ -287,7 +287,7 @@ func (api *API) Field(ctx context.Context, indexName, fieldName string) (*Field,
field := api.holder.Field(indexName, fieldName)
if field == nil {
return nil, NewNotFoundError(ErrFieldNotFound)
return nil, newNotFoundError(ErrFieldNotFound)
}
return field, nil
}
@ -303,7 +303,7 @@ func (api *API) DeleteField(ctx context.Context, indexName string, fieldName str
// Find index.
index := api.holder.Index(indexName)
if index == nil {
return NewNotFoundError(ErrIndexNotFound)
return newNotFoundError(ErrIndexNotFound)
}
// Delete field from the index.
@ -543,7 +543,7 @@ func (api *API) IndexAttrDiff(ctx context.Context, indexName string, blocks []At
// Retrieve index from holder.
index := api.holder.Index(indexName)
if index == nil {
return nil, NewNotFoundError(ErrIndexNotFound)
return nil, newNotFoundError(ErrIndexNotFound)
}
// Retrieve local blocks.
@ -685,7 +685,7 @@ func (api *API) indexField(indexName string, fieldName string, shard uint64) (*I
index := api.holder.Index(indexName)
if index == nil {
api.server.logger.Printf("fragment error: index=%s, field=%s, shard=%d, err=%s", indexName, fieldName, shard, ErrIndexNotFound.Error())
return nil, nil, NewNotFoundError(ErrIndexNotFound)
return nil, nil, newNotFoundError(ErrIndexNotFound)
}
// Retrieve field.

View file

@ -374,7 +374,7 @@ func (h *Holder) DeleteIndex(name string) error {
// Confirm index exists.
index := h.index(name)
if index == nil {
return NewNotFoundError(ErrIndexNotFound)
return newNotFoundError(ErrIndexNotFound)
}
// Close index.

View file

@ -378,7 +378,7 @@ func (i *Index) DeleteField(name string) error {
// Confirm field exists.
f := i.field(name)
if f == nil {
return NewNotFoundError(ErrFieldNotFound)
return newNotFoundError(ErrFieldNotFound)
}
// Close field.

View file

@ -104,8 +104,8 @@ type NotFoundError struct {
error
}
// NewNotFoundError returns err wrapped in a NotFoundError.
func NewNotFoundError(err error) NotFoundError {
// newNotFoundError returns err wrapped in a NotFoundError.
func newNotFoundError(err error) NotFoundError {
return NotFoundError{err}
}