mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-10-07 11:27:50 +00:00
return correct ErrFieldExists so we give an HTTP 409
This commit is contained in:
parent
25dce501fe
commit
8f7f5324d4
1 changed files with 3 additions and 1 deletions
4
index.go
4
index.go
|
|
@ -669,7 +669,9 @@ func (i *Index) persistField(ctx context.Context, cfm *CreateFieldMessage) error
|
|||
|
||||
if b, err := i.serializer.Marshal(cfm); err != nil {
|
||||
return errors.Wrap(err, "marshaling")
|
||||
} else if err := i.Schemator.CreateField(ctx, cfm.Index, cfm.Field, b); err != nil {
|
||||
} else if err := i.Schemator.CreateField(ctx, cfm.Index, cfm.Field, b); errors.Cause(err) == disco.ErrFieldExists {
|
||||
return ErrFieldExists
|
||||
} else if err != nil {
|
||||
return errors.Wrapf(err, "writing field to disco: %s/%s", cfm.Index, cfm.Field)
|
||||
}
|
||||
return nil
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue