From 3b0131f0cd0c330fb501e5eb841fbf625e2a85cd Mon Sep 17 00:00:00 2001 From: Laurent Luce Date: Tue, 24 Sep 2024 19:25:30 -0700 Subject: [PATCH] Return 500 error if flow failed to be created --- kontrol-service/api/server.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/kontrol-service/api/server.go b/kontrol-service/api/server.go index 5852cb7..9e2818d 100644 --- a/kontrol-service/api/server.go +++ b/kontrol-service/api/server.go @@ -185,8 +185,12 @@ func (sv *Server) PostTenantUuidFlowCreate(_ context.Context, request api.PostTe flowId, flowUrls, err := applyProdDevFlow(sv, request.Uuid, patches, templateSpec) if err != nil { - logrus.Errorf("an error occured while updating dev flow. error was \n: '%v'", err.Error()) - return nil, err + errMsg := "An error occurred creating flow" + errResp := api.ErrorJSONResponse{ + Error: err.Error(), + Msg: &errMsg, + } + return api.PostTenantUuidFlowCreate500JSONResponse{errResp}, nil } resp := apitypes.Flow{FlowId: *flowId, FlowUrls: flowUrls} return api.PostTenantUuidFlowCreate200JSONResponse(resp), nil