Change ErrOrganizationNameTaken to ErrOrganizationAlreadyExists for consistency

pull/2435/head
Jared Scheib 2017-11-30 20:10:30 -08:00
parent 3aded9cca7
commit 7eed603bf7
3 changed files with 5 additions and 5 deletions

View File

@ -87,7 +87,7 @@ func (s *OrganizationsStore) DefaultOrganization(ctx context.Context) (*chronogr
// Add creates a new Organization in the OrganizationsStore
func (s *OrganizationsStore) Add(ctx context.Context, o *chronograf.Organization) (*chronograf.Organization, error) {
if !s.nameIsUnique(ctx, o.Name) {
return nil, chronograf.ErrOrganizationNameTaken
return nil, chronograf.ErrOrganizationAlreadyExists
}
if err := s.client.db.Update(func(tx *bolt.Tx) error {
b := tx.Bucket(OrganizationsBucket)
@ -276,7 +276,7 @@ func (s *OrganizationsStore) Update(ctx context.Context, o *chronograf.Organizat
return err
}
if o.Name != org.Name && !s.nameIsUnique(ctx, o.Name) {
return chronograf.ErrOrganizationNameTaken
return chronograf.ErrOrganizationAlreadyExists
}
return s.client.db.Update(func(tx *bolt.Tx) error {
if v, err := internal.MarshalOrganization(o); err != nil {

View File

@ -373,7 +373,7 @@ func TestOrganizationsStore_Update(t *testing.T) {
addFirst: true,
},
{
name: "Update organization name - name already taken",
name: "Update organization name - organization already exists",
fields: fields{
orgs: []chronograf.Organization{
{
@ -552,7 +552,7 @@ func TestOrganizationsStore_Add(t *testing.T) {
wantErr bool
}{
{
name: "Add organization - name already taken",
name: "Add organization - organization already exists",
fields: fields{
orgs: []chronograf.Organization{
{

View File

@ -33,7 +33,7 @@ const (
ErrAuthentication = Error("user not authenticated")
ErrUninitialized = Error("client uninitialized. Call Open() method")
ErrInvalidAxis = Error("Unexpected axis in cell. Valid axes are 'x', 'y', and 'y2'")
ErrOrganizationNameTaken = Error("organization name is taken")
ErrOrganizationAlreadyExists = Error("organization already exists")
ErrCannotDeleteDefaultOrganization = Error("cannot delete default organization")
)