Skip to content

fix: returned error with proper status code #4336

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pkg/appWorkflow/AppWorkflowService.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.")}
Expand Down
6 changes: 5 additions & 1 deletion pkg/pipeline/CiHandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down