Skip to content

Commit 5765dcb

Browse files
authored
Fix panic in GetJobErrors when Job has no error (#4307)
* fix panic in GetJobErrors when no error present Signed-off-by: Chris Martin <[email protected]> * fix test Signed-off-by: Chris Martin <[email protected]> --------- Signed-off-by: Chris Martin <[email protected]>
1 parent 8deb192 commit 5765dcb

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

internal/server/queryapi/query_api.go

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -153,11 +153,15 @@ func (q *QueryApi) GetJobErrors(ctx context.Context, req *api.JobErrorsRequest)
153153
decompressor := q.decompressorFactory()
154154
errorsById := make(map[string]string, len(queryResult))
155155
for _, row := range queryResult {
156-
decompressed, err := decompressor.Decompress(row.Error)
157-
if err != nil {
158-
return nil, err
156+
if len(row.Error) > 0 {
157+
decompressed, err := decompressor.Decompress(row.Error)
158+
if err != nil {
159+
return nil, err
160+
}
161+
errorsById[row.JobID] = string(decompressed)
162+
} else {
163+
errorsById[row.JobID] = ""
159164
}
160-
errorsById[row.JobID] = string(decompressed)
161165
}
162166
return &api.JobErrorsResponse{
163167
JobErrors: errorsById,

0 commit comments

Comments
 (0)