From 7e8f7155d7253e5bc34568181e484857c659d3b3 Mon Sep 17 00:00:00 2001 From: Simone Gotti Date: Fri, 15 Nov 2019 15:49:58 +0100 Subject: [PATCH] runservice: improve errors in logsHandler return errNotExist in readTaskLogs when the run,task or step doesn't exist. --- internal/services/runservice/api/api.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/services/runservice/api/api.go b/internal/services/runservice/api/api.go index 90d8f99..f74c444 100644 --- a/internal/services/runservice/api/api.go +++ b/internal/services/runservice/api/api.go @@ -209,15 +209,15 @@ func (h *LogsHandler) readTaskLogs(ctx context.Context, runID, taskID string, se return err, true } if r == nil { - return errors.Errorf("no such run with id: %s", runID), true + return util.NewErrNotExist(errors.Errorf("no such run with id: %s", runID)), true } task, ok := r.Tasks[taskID] if !ok { - return errors.Errorf("no such task with ID %s in run %s", taskID, runID), true + return util.NewErrNotExist(errors.Errorf("no such task with ID %s in run %s", taskID, runID)), true } if len(task.Steps) <= step { - return errors.Errorf("no such step for task %s in run %s", taskID, runID), true + return util.NewErrNotExist(errors.Errorf("no such step for task %s in run %s", taskID, runID)), true } // if the log has been already fetched use it, otherwise fetch it from the executor