worker/osbuild: move target errors to detail of job error
Add a new worker client error type `ErrorTargetError` representing that at least one of job targets failed. The actual target errors are added to the job detail. Add a new `OSBuildJobResult.TargetErrors()` method for gathering a slice of target errors contained within an `OSBuildJobResult` instance. Cover the method with unit test.
This commit is contained in:
parent
20cb2e1b2c
commit
6dcadc9d20
5 changed files with 112 additions and 3 deletions
|
|
@ -258,6 +258,8 @@ func (s *Server) OSBuildJobStatus(id uuid.UUID, result *OSBuildJobResult) (*JobS
|
|||
result.JobError = clienterrors.WorkerClientError(clienterrors.ErrorBuildJob, "osbuild build failed")
|
||||
} else if len(result.OSBuildOutput.Error) > 0 {
|
||||
result.JobError = clienterrors.WorkerClientError(clienterrors.ErrorOldResultCompatible, string(result.OSBuildOutput.Error))
|
||||
} else if len(result.TargetErrors()) > 0 {
|
||||
result.JobError = clienterrors.WorkerClientError(clienterrors.ErrorTargetError, "at least one target failed", result.TargetErrors())
|
||||
}
|
||||
}
|
||||
// For backwards compatibility: OSBuildJobResult didn't use to have a
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue