Skip to content

Commit

Permalink
osbuild-worker: tweak error to not include a \n for a failed stage
Browse files Browse the repository at this point in the history
Small followup for
osbuild#4113 (comment)

Given that the failed stage is a relatively short string the `\n`
seems unneccessary and quotes are enough.
  • Loading branch information
mvo5 committed Jul 10, 2024
1 parent 7cd5abd commit 7a84b6a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
4 changes: 2 additions & 2 deletions cmd/osbuild-worker/jobimpl-osbuild.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
3 changes: 1 addition & 2 deletions cmd/osbuild-worker/jobimpl-osbuild_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down

0 comments on commit 7a84b6a

Please sign in to comment.