Merge pull request #181 from sgotti/runservice_logshandler_improve_errors_02

runservice: improve errors in logsHandler
This commit is contained in:
Simone Gotti 2019-11-15 16:46:40 +01:00 committed by GitHub
commit 3ff18510a6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -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