clienterrors: rename WorkerClientError to clienterrors.New

The usual convention to create new object is to prefix `New*` so
this commit renames the `WorkerClientError`. Initially I thought
it would be `NewWorkerClientError()` but looking at the package
prefix it seems unneeded, i.e. `clienterrors.New()` already
provides enough context it seems and it's the only error we
construct.

We could consider renaming it to `clienterror` (singular) too
but that could be a followup.

I would also like to make `clienterror.Error` implement the
`error` interface but that should be a followup to make this
(mechanical) rename trivial to review.
This commit is contained in:
Michael Vogt 2024-05-13 17:39:01 +02:00
parent 09445a1030
commit 573b349f16
19 changed files with 188 additions and 188 deletions

View file

@ -57,7 +57,7 @@ func (impl *KojiInitJobImpl) Run(job worker.Job) error {
var result worker.KojiInitJobResult
result.Token, result.BuildID, err = impl.kojiInit(args.Server, args.Name, args.Version, args.Release)
if err != nil {
result.JobError = clienterrors.WorkerClientError(clienterrors.ErrorKojiInit, err.Error(), nil)
result.JobError = clienterrors.New(clienterrors.ErrorKojiInit, err.Error(), nil)
}
err = job.Update(&result)