From be2fd3fee3a064939e281f0d2d844f62ba013a2c Mon Sep 17 00:00:00 2001 From: Idriss Neumann Date: Sat, 16 Dec 2023 12:22:34 +0100 Subject: [PATCH] Issue #4: no need for formated exception --- pkg/quickwit/quickwit.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pkg/quickwit/quickwit.go b/pkg/quickwit/quickwit.go index 36ba450..d9b24c7 100644 --- a/pkg/quickwit/quickwit.go +++ b/pkg/quickwit/quickwit.go @@ -4,6 +4,7 @@ import ( "bytes" "context" "encoding/json" + "errors" "fmt" "io" "net/http" @@ -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() @@ -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 @@ -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))