Skip to content

Commit

Permalink
Issue #4: no need for formated exception
Browse files Browse the repository at this point in the history
  • Loading branch information
idrissneumann committed Dec 16, 2023
1 parent ae3d633 commit be2fd3f
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions pkg/quickwit/quickwit.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"bytes"
"context"
"encoding/json"
"errors"
"fmt"
"io"
"net/http"
Expand Down Expand Up @@ -51,7 +52,7 @@ func getTimestampFieldInfos(index string, qwUrl string, cli *http.Client) (strin
if statusCode < 200 || statusCode >= 400 {
errMsg := fmt.Sprintf("Error when calling url = %s: statusCode = %d", mappingEndpointUrl, statusCode)
qwlog.Error(errMsg)
return "", "", fmt.Errorf(errMsg)
return "", "", errors.New(errMsg)
}

defer r.Body.Close()
Expand All @@ -67,7 +68,7 @@ func getTimestampFieldInfos(index string, qwUrl string, cli *http.Client) (strin
if err != nil {
errMsg := fmt.Sprintf("Unmarshalling body error: err = %s, body = %s", err.Error(), (body))
qwlog.Error(errMsg)
return "", "", fmt.Errorf(errMsg)
return "", "", errors.New(errMsg)
}

timestampFieldName := payload.IndexConfig.DocMapping.TimestampField
Expand All @@ -82,7 +83,7 @@ func getTimestampFieldInfos(index string, qwUrl string, cli *http.Client) (strin
if timestampFieldFormat == "undef" {
errMsg := fmt.Sprintf("No format found for field: %s", string(timestampFieldName))
qwlog.Error(errMsg)
return timestampFieldName, "", fmt.Errorf(errMsg)
return timestampFieldName, "", errors.New(errMsg)
}

qwlog.Info(fmt.Sprintf("Found timestampFieldName = %s, timestampFieldFormat = %s", timestampFieldName, timestampFieldFormat))
Expand Down

0 comments on commit be2fd3f

Please sign in to comment.