worker/clienterrors: add empty packagespec error
Add an error case for an empty package spec returned by a depsolve job and mark this with a `4xx` status.
This commit is contained in:
parent
5dffb9f59c
commit
14b006d480
2 changed files with 12 additions and 4 deletions
|
|
@ -283,6 +283,11 @@ func generateManifest(ctx context.Context, workers *worker.Server, depsolveJobID
|
|||
return
|
||||
}
|
||||
|
||||
if len(depsolveResults.PackageSpecs) == 0 {
|
||||
jobResult.JobError = clienterrors.WorkerClientError(clienterrors.ErrorEmptyPackageSpecs, "Received empty package specs")
|
||||
return
|
||||
}
|
||||
|
||||
manifest, err := imageType.Manifest(b, options, repos, depsolveResults.PackageSpecs, seed)
|
||||
if err != nil {
|
||||
reason := "Error generating manifest"
|
||||
|
|
|
|||
|
|
@ -21,10 +21,11 @@ const (
|
|||
ErrorOldResultCompatible ClientErrorCode = 18
|
||||
ErrorEmptyManifest ClientErrorCode = 19
|
||||
|
||||
ErrorDNFDepsolveError ClientErrorCode = 20
|
||||
ErrorDNFMarkingErrors ClientErrorCode = 21
|
||||
ErrorDNFOtherError ClientErrorCode = 22
|
||||
ErrorRPMMDError ClientErrorCode = 23
|
||||
ErrorDNFDepsolveError ClientErrorCode = 20
|
||||
ErrorDNFMarkingErrors ClientErrorCode = 21
|
||||
ErrorDNFOtherError ClientErrorCode = 22
|
||||
ErrorRPMMDError ClientErrorCode = 23
|
||||
ErrorEmptyPackageSpecs ClientErrorCode = 24
|
||||
)
|
||||
|
||||
type ClientErrorCode int
|
||||
|
|
@ -68,6 +69,8 @@ func GetStatusCode(err *Error) StatusCode {
|
|||
return JobStatusUserInputError
|
||||
case ErrorManifestDependency:
|
||||
return JobStatusUserInputError
|
||||
case ErrorEmptyPackageSpecs:
|
||||
return JobStatusUserInputError
|
||||
case ErrorEmptyManifest:
|
||||
return JobStatusUserInputError
|
||||
default:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue