diff --git a/internal/store/store.go b/internal/store/store.go index 2438b6d43..0a24d1bdc 100644 --- a/internal/store/store.go +++ b/internal/store/store.go @@ -382,7 +382,7 @@ func (s *Store) PushCompose(composeID uuid.UUID, bp *blueprint.Blueprint, compos } pipeline, err := bp.ToPipeline(composeType) if err != nil { - return &InvalidRequestError{"invalid output type: " + composeType} + return err } s.change(func() error { s.Composes[composeID] = Compose{ diff --git a/internal/weldr/api.go b/internal/weldr/api.go index 7e9e370f3..c5985f0e9 100644 --- a/internal/weldr/api.go +++ b/internal/weldr/api.go @@ -757,7 +757,19 @@ func (api *API) composeHandler(writer http.ResponseWriter, httpRequest *http.Req found := api.store.GetBlueprint(cr.BlueprintName, &bp, &changed) // TODO: what to do with changed? if found { - api.store.PushCompose(reply.BuildID, &bp, cr.ComposeType) + err := api.store.PushCompose(reply.BuildID, &bp, cr.ComposeType) + + // TODO: we should probably do some kind of blueprint validation in future + // for now, let's just 500 and bail out + if err != nil { + log.Println("error when pushing new compose: ", err.Error()) + errors := responseError{ + ID: "ComposePushErrored", + Msg: err.Error(), + } + statusResponseError(writer, http.StatusInternalServerError, errors) + return + } } else { errors := responseError{ ID: "UnknownBlueprint",