From a6f48bcd2f2cab8ecee322a94095393b96dd4946 Mon Sep 17 00:00:00 2001 From: "Brian C. Lane" Date: Fri, 31 Jan 2025 13:39:44 -0800 Subject: [PATCH] cloudapi: Add error information to ErrorUnknownUploadTarget It can include useful extra details, whether or not the artifacts directory is setup, whether the file is missing, etc. Related: RHEL-60142 --- internal/cloudapi/v2/handler.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/cloudapi/v2/handler.go b/internal/cloudapi/v2/handler.go index e3f66576a..f7ab8c149 100644 --- a/internal/cloudapi/v2/handler.go +++ b/internal/cloudapi/v2/handler.go @@ -365,7 +365,7 @@ func (h *apiHandlers) getJobIDComposeStatus(jobId uuid.UUID) (ComposeStatus, err tr := result.TargetResults[idx] us, err := h.targetResultToUploadStatus(jobId, tr) if err != nil { - return ComposeStatus{}, HTTPError(ErrorUnknownUploadTarget) + return ComposeStatus{}, HTTPErrorWithInternal(ErrorUnknownUploadTarget, err) } us.Status = uploadStatusFromJobStatus(jobInfo.JobStatus, result.JobError) statuses[idx] = *us @@ -430,7 +430,7 @@ func (h *apiHandlers) getJobIDComposeStatus(jobId uuid.UUID) (ComposeStatus, err if tr.Name != target.TargetNameKoji { us, err := h.targetResultToUploadStatus(jobId, tr) if err != nil { - return ComposeStatus{}, HTTPError(ErrorUnknownUploadTarget) + return ComposeStatus{}, HTTPErrorWithInternal(ErrorUnknownUploadTarget, err) } us.Status = uploadStatusFromJobStatus(buildInfo.JobStatus, result.JobError) statuses = append(statuses, *us) @@ -1191,7 +1191,7 @@ func (h *apiHandlers) postCloneComposeImpl(ctx echo.Context, id string) error { var us *UploadStatus us, err = h.targetResultToUploadStatus(jobId, osbuildResult.TargetResults[0]) if err != nil { - return HTTPError(ErrorUnknownUploadTarget) + return HTTPErrorWithInternal(ErrorUnknownUploadTarget, err) } var osbuildJob worker.OSBuildJob