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
|
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)
|
manifest, err := imageType.Manifest(b, options, repos, depsolveResults.PackageSpecs, seed)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
reason := "Error generating manifest"
|
reason := "Error generating manifest"
|
||||||
|
|
|
||||||
|
|
@ -21,10 +21,11 @@ const (
|
||||||
ErrorOldResultCompatible ClientErrorCode = 18
|
ErrorOldResultCompatible ClientErrorCode = 18
|
||||||
ErrorEmptyManifest ClientErrorCode = 19
|
ErrorEmptyManifest ClientErrorCode = 19
|
||||||
|
|
||||||
ErrorDNFDepsolveError ClientErrorCode = 20
|
ErrorDNFDepsolveError ClientErrorCode = 20
|
||||||
ErrorDNFMarkingErrors ClientErrorCode = 21
|
ErrorDNFMarkingErrors ClientErrorCode = 21
|
||||||
ErrorDNFOtherError ClientErrorCode = 22
|
ErrorDNFOtherError ClientErrorCode = 22
|
||||||
ErrorRPMMDError ClientErrorCode = 23
|
ErrorRPMMDError ClientErrorCode = 23
|
||||||
|
ErrorEmptyPackageSpecs ClientErrorCode = 24
|
||||||
)
|
)
|
||||||
|
|
||||||
type ClientErrorCode int
|
type ClientErrorCode int
|
||||||
|
|
@ -68,6 +69,8 @@ func GetStatusCode(err *Error) StatusCode {
|
||||||
return JobStatusUserInputError
|
return JobStatusUserInputError
|
||||||
case ErrorManifestDependency:
|
case ErrorManifestDependency:
|
||||||
return JobStatusUserInputError
|
return JobStatusUserInputError
|
||||||
|
case ErrorEmptyPackageSpecs:
|
||||||
|
return JobStatusUserInputError
|
||||||
case ErrorEmptyManifest:
|
case ErrorEmptyManifest:
|
||||||
return JobStatusUserInputError
|
return JobStatusUserInputError
|
||||||
default:
|
default:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue