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

@ -92,7 +92,7 @@ func TestTargetResultUnmarshal(t *testing.T) {
resultJSON: []byte(`{"name":"org.osbuild.aws","target_error":{"id":11,"reason":"failed to uplad image","details":"detail"}}`),
expectedResult: &TargetResult{
Name: TargetNameAWS,
TargetError: clienterrors.WorkerClientError(clienterrors.ErrorUploadingImage, "failed to uplad image", "detail"),
TargetError: clienterrors.New(clienterrors.ErrorUploadingImage, "failed to uplad image", "detail"),
},
},
// unknown target name