diff --git a/pkg/appWorkflow/AppWorkflowService.go b/pkg/appWorkflow/AppWorkflowService.go index b4ceedb2f7..cec9f6f96a 100644 --- a/pkg/appWorkflow/AppWorkflowService.go +++ b/pkg/appWorkflow/AppWorkflowService.go @@ -253,6 +253,7 @@ func (impl AppWorkflowServiceImpl) DeleteAppWorkflow(appWorkflowId int, userId i } if len(mappingForCI) > 0 { return &util.ApiError{ + Code: "400", InternalMessage: "Workflow contains pipelines. First delete all pipelines in the workflow.", UserDetailMessage: fmt.Sprintf("Workflow contains pipelines. First delete all pipelines in the workflow."), UserMessage: fmt.Sprintf("Workflow contains pipelines. First delete all pipelines in the workflow.")} diff --git a/pkg/pipeline/CiHandler.go b/pkg/pipeline/CiHandler.go index 19fdde0b2e..1326601d69 100644 --- a/pkg/pipeline/CiHandler.go +++ b/pkg/pipeline/CiHandler.go @@ -588,7 +588,11 @@ func (impl *CiHandlerImpl) CancelBuild(workflowId int) (int, error) { } if !(string(v1alpha1.NodePending) == workflow.Status || string(v1alpha1.NodeRunning) == workflow.Status) { impl.Logger.Warn("cannot cancel build, build not in progress") - return 0, errors.New("cannot cancel build, build not in progress") + return 0, &util.ApiError{ + Code: "400", + UserMessage: "cannot cancel build, build not in progress", + InternalMessage: "cannot cancel build, build not in progress", + } } isExt := workflow.Namespace != DefaultCiWorkflowNamespace var env *repository3.Environment