Skip to content

Commit

Permalink
fix: error handling when creating TW (#5631)
Browse files Browse the repository at this point in the history
* fix: error handling when creating TW

* fix: remove object.name update

* fix: move error to debug

* fix: handle error on update
  • Loading branch information
exu authored and vsukhin committed Jul 3, 2024
1 parent dbe6284 commit 5f734c4
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion cmd/kubectl-testkube/commands/testworkflows/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,15 @@ func NewCreateTestWorkflowCmd() *cobra.Command {
}
}

workflow, _ := client.GetTestWorkflow(obj.Name)
workflow, err := client.GetTestWorkflow(obj.Name)
if err != nil {
if update {
ui.ExitOnError("getting test workflow "+obj.Name+" in namespace "+obj.Namespace, err)
} else {
ui.Debug("getting test workflow "+obj.Name+" in namespace "+obj.Namespace, err.Error())
}
}

if workflow.Name != "" {
if !update {
ui.Failf("Test workflow with name '%s' already exists in namespace %s, use --update flag for upsert", obj.Name, namespace)
Expand Down

0 comments on commit 5f734c4

Please sign in to comment.