mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-09-10 15:01:03 +00:00
use constructors for errors
This commit is contained in:
parent
9633e34300
commit
c0b5ad316d
2 changed files with 4 additions and 4 deletions
|
|
@ -304,7 +304,7 @@ func (h *Holder) CreateIndex(name string, opt IndexOptions) (*Index, error) {
|
|||
|
||||
// Ensure index doesn't already exist.
|
||||
if h.indexes[name] != nil {
|
||||
return nil, ConflictError{ErrIndexExists}
|
||||
return nil, NewConflictError(ErrIndexExists)
|
||||
}
|
||||
return h.createIndex(name, opt)
|
||||
}
|
||||
|
|
@ -374,7 +374,7 @@ func (h *Holder) DeleteIndex(name string) error {
|
|||
// Confirm index exists.
|
||||
index := h.index(name)
|
||||
if index == nil {
|
||||
return NotFoundError{ErrIndexNotFound}
|
||||
return NewNotFoundError(ErrIndexNotFound)
|
||||
}
|
||||
|
||||
// Close index.
|
||||
|
|
|
|||
4
index.go
4
index.go
|
|
@ -276,7 +276,7 @@ func (i *Index) CreateField(name string, opt FieldOptions) (*Field, error) {
|
|||
|
||||
// Ensure field doesn't already exist.
|
||||
if i.fields[name] != nil {
|
||||
return nil, ConflictError{ErrFieldExists}
|
||||
return nil, NewConflictError(ErrFieldExists)
|
||||
}
|
||||
return i.createField(name, opt)
|
||||
}
|
||||
|
|
@ -349,7 +349,7 @@ func (i *Index) DeleteField(name string) error {
|
|||
// Confirm field exists.
|
||||
f := i.field(name)
|
||||
if f == nil {
|
||||
return NotFoundError{ErrFieldNotFound}
|
||||
return NewNotFoundError(ErrFieldNotFound)
|
||||
}
|
||||
|
||||
// Close field.
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue