osbuild-worker: tweak error to not include a \n for a failed stage

Small followup for
https://github.com/osbuild/osbuild-composer/pull/4113#discussion_r1670063775

Given that the failed stage is a relatively short string the `\n`
seems unneccessary and quotes are enough.
This commit is contained in:
Michael Vogt 2024-07-10 12:34:05 +02:00 committed by Tomáš Hozza
parent 4ba7085068
commit 919b423953
2 changed files with 3 additions and 4 deletions

View file

@ -372,8 +372,8 @@ func makeJobErrorFromOsbuildOutput(osbuildOutput *osbuild.Result) *clienterrors.
}
reason := "osbuild build failed"
if len(failedStage) > 0 {
reason += " in stage:\n" + failedStage
if failedStage != "" {
reason += fmt.Sprintf(" in stage: %q", failedStage)
}
return clienterrors.WorkerClientError(clienterrors.ErrorBuildJob, reason, osbErrors)
}

View file

@ -34,8 +34,7 @@ func TestMakeJobErrorFromOsbuildOutput(t *testing.T) {
},
},
},
expected: `Code: 10, Reason: osbuild build failed in stage:
bad-stage, Details: []`,
expected: `Code: 10, Reason: osbuild build failed in stage: "bad-stage", Details: []`,
},
{
inputData: &osbuild.Result{