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:
Tomas Hozza 2022-06-14 18:29:52 +02:00 committed by Tom Gundersen
parent 20cb2e1b2c
commit 6dcadc9d20
5 changed files with 112 additions and 3 deletions

View file

@ -28,6 +28,7 @@ const (
ErrorDNFRepoError ClientErrorCode = 25
ErrorJobDependency ClientErrorCode = 26
ErrorJobMissingHeartbeat ClientErrorCode = 27
ErrorTargetError ClientErrorCode = 28
)
type ClientErrorCode int
@ -69,6 +70,8 @@ func GetStatusCode(err *Error) StatusCode {
return JobStatusUserInputError
case ErrorInvalidTarget:
return JobStatusUserInputError
case ErrorTargetError:
return JobStatusUserInputError
case ErrorDepsolveDependency:
return JobStatusUserInputError
case ErrorManifestDependency: