Skip to content

Commit

Permalink
error before 404
Browse files Browse the repository at this point in the history
  • Loading branch information
andy committed Aug 13, 2024
1 parent 22b287e commit a6d2d26
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 16 deletions.
8 changes: 4 additions & 4 deletions pkg/es/es5.go
Original file line number Diff line number Diff line change
Expand Up @@ -293,14 +293,14 @@ func (es *V5) CreateIndex(esSetting IESSettings) error {

func (es *V5) IndexExisted(indexName string) (bool, error) {
res, err := es.Client.Indices.Exists([]string{indexName})
if res.StatusCode == 404 {
return false, nil
}

if err != nil {
return false, errors.WithStack(err)
}

if res.StatusCode == 404 {
return false, nil
}

defer func() {
_ = res.Body.Close()
}()
Expand Down
8 changes: 4 additions & 4 deletions pkg/es/es6.go
Original file line number Diff line number Diff line change
Expand Up @@ -270,14 +270,14 @@ func (es *V6) CreateIndex(esSetting IESSettings) error {

func (es *V6) IndexExisted(indexName string) (bool, error) {
res, err := es.Client.Indices.Exists([]string{indexName})
if res.StatusCode == 404 {
return false, nil
}

if err != nil {
return false, errors.WithStack(err)
}

if res.StatusCode == 404 {
return false, nil
}

defer func() {
_ = res.Body.Close()
}()
Expand Down
8 changes: 4 additions & 4 deletions pkg/es/es7.go
Original file line number Diff line number Diff line change
Expand Up @@ -294,14 +294,14 @@ func (es *V7) CreateIndex(esSetting IESSettings) error {

func (es *V7) IndexExisted(indexName string) (bool, error) {
res, err := es.Client.Indices.Exists([]string{indexName})
if res.StatusCode == 404 {
return false, nil
}

if err != nil {
return false, errors.WithStack(err)
}

if res.StatusCode == 404 {
return false, nil
}

defer func() {
_ = res.Body.Close()
}()
Expand Down
8 changes: 4 additions & 4 deletions pkg/es/es8.go
Original file line number Diff line number Diff line change
Expand Up @@ -295,14 +295,14 @@ func (es *V8) CreateIndex(esSetting IESSettings) error {

func (es *V8) IndexExisted(indexName string) (bool, error) {
res, err := es.Client.Indices.Exists([]string{indexName})
if res.StatusCode == 404 {
return false, nil
}

if err != nil {
return false, errors.WithStack(err)
}

if res.StatusCode == 404 {
return false, nil
}

defer func() {
_ = res.Body.Close()
}()
Expand Down

0 comments on commit a6d2d26

Please sign in to comment.