chore: improve error message readability (#5628)

This commit is contained in:
Srikanth Chekuri 2024-09-13 18:01:37 +05:30 committed by GitHub
parent 39f9fc6900
commit 5b22490d6d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 16 additions and 8 deletions

View File

@ -4997,7 +4997,7 @@ func (r *ClickHouseReader) GetTimeSeriesResultV3(ctx context.Context, query stri
if err != nil {
zap.L().Error("error while reading time series result", zap.Error(err))
return nil, err
return nil, errors.New(err.Error())
}
defer rows.Close()
@ -5044,7 +5044,7 @@ func (r *ClickHouseReader) GetListResultV3(ctx context.Context, query string) ([
if err != nil {
zap.L().Error("error while reading time series result", zap.Error(err))
return nil, err
return nil, errors.New(err.Error())
}
defer rows.Close()

View File

@ -3716,8 +3716,12 @@ func (aH *APIHandler) queryRangeV3(ctx context.Context, queryRangeParams *v3.Que
result, errQuriesByName, err = aH.querier.QueryRange(ctx, queryRangeParams)
if err != nil {
apiErrObj := &model.ApiError{Typ: model.ErrorBadData, Err: err}
RespondError(w, apiErrObj, errQuriesByName)
queryErrors := map[string]string{}
for name, err := range errQuriesByName {
queryErrors[fmt.Sprintf("Query-%s", name)] = err.Error()
}
apiErrObj := &model.ApiError{Typ: model.ErrorInternal, Err: err}
RespondError(w, apiErrObj, queryErrors)
return
}
@ -4160,8 +4164,12 @@ func (aH *APIHandler) queryRangeV4(ctx context.Context, queryRangeParams *v3.Que
result, errQuriesByName, err = aH.querierV2.QueryRange(ctx, queryRangeParams)
if err != nil {
apiErrObj := &model.ApiError{Typ: model.ErrorBadData, Err: err}
RespondError(w, apiErrObj, errQuriesByName)
queryErrors := map[string]string{}
for name, err := range errQuriesByName {
queryErrors[fmt.Sprintf("Query-%s", name)] = err.Error()
}
apiErrObj := &model.ApiError{Typ: model.ErrorInternal, Err: err}
RespondError(w, apiErrObj, queryErrors)
return
}

View File

@ -566,7 +566,7 @@ func (q *querier) runBuilderListQueries(ctx context.Context, params *v3.QueryRan
rowList, err := q.reader.GetListResultV3(ctx, query)
if err != nil {
ch <- channelResult{Err: fmt.Errorf("error in query-%s: %v", name, err), Name: name, Query: query}
ch <- channelResult{Err: err, Name: name, Query: query}
return
}
ch <- channelResult{List: rowList, Name: name, Query: query}

View File

@ -574,7 +574,7 @@ func (q *querier) runBuilderListQueries(ctx context.Context, params *v3.QueryRan
rowList, err := q.reader.GetListResultV3(ctx, query)
if err != nil {
ch <- channelResult{Err: fmt.Errorf("error in query-%s: %v", name, err), Name: name, Query: query}
ch <- channelResult{Err: err, Name: name, Query: query}
return
}
ch <- channelResult{List: rowList, Name: name, Query: query}