Skip to content

Commit c8b3943

Browse files
committed
api error
1 parent 7e5be55 commit c8b3943

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

pkg/pipeline/WorkflowService.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import (
2222
"errors"
2323
v1alpha12 "github.com/argoproj/argo-workflows/v3/pkg/client/clientset/versioned/typed/workflow/v1alpha1"
2424
"github.com/argoproj/argo-workflows/v3/workflow/util"
25+
"github.com/devtron-labs/common-lib/utils"
2526
"github.com/devtron-labs/common-lib/utils/k8s"
2627
"github.com/devtron-labs/common-lib/utils/k8s/commonBean"
2728
"github.com/devtron-labs/devtron/api/bean"
@@ -39,6 +40,8 @@ import (
3940
v12 "k8s.io/api/core/v1"
4041
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
4142
"k8s.io/client-go/rest"
43+
"net/http"
44+
"strconv"
4245
"strings"
4346
)
4447

@@ -380,7 +383,7 @@ func (impl *WorkflowServiceImpl) TerminateDanglingWorkflows(cancelWfDtoRequest *
380383
var err error
381384
workflowExecutor := impl.getWorkflowExecutor(cancelWfDtoRequest.ExecutorType)
382385
if workflowExecutor == nil {
383-
return errors.New("workflow executor not found")
386+
return &utils.ApiError{HttpStatusCode: http.StatusNotFound, Code: strconv.Itoa(http.StatusNotFound), InternalMessage: "workflow executor not found", UserMessage: "workflow executor not found"}
384387
}
385388
if cancelWfDtoRequest.RestConfig == nil {
386389
cancelWfDtoRequest.RestConfig = impl.config

0 commit comments

Comments
 (0)