worker/clienterrors: add empty manifest error

If a manifest is empty we should have a specific error
code for that case and treat it as a 4xx error since
this would be bad input for a build job
This commit is contained in:
Gianluca Zuccarelli 2022-03-23 13:46:45 +00:00 committed by Sanne Raymaekers
parent 62ab822695
commit 8241e1f948
2 changed files with 5 additions and 2 deletions

View file

@ -124,12 +124,12 @@ func (impl *OSBuildKojiJobImpl) Run(job worker.Job) error {
args.Manifest = manifestJR.Manifest
if len(args.Manifest) == 0 {
err := fmt.Errorf("Received empty manifest")
result.JobError = clienterrors.WorkerClientError(clienterrors.ErrorManifestDependency, err.Error())
result.JobError = clienterrors.WorkerClientError(clienterrors.ErrorEmptyManifest, err.Error())
return err
}
} else {
err := fmt.Errorf("Job has no manifest")
result.JobError = clienterrors.WorkerClientError(clienterrors.ErrorManifestDependency, err.Error())
result.JobError = clienterrors.WorkerClientError(clienterrors.ErrorEmptyManifest, err.Error())
return err
}
}