Skip to content

Commit

Permalink
Update cluster and task error message
Browse files Browse the repository at this point in the history
  • Loading branch information
sestrella committed Nov 10, 2024
1 parent f22ed4f commit 9395e81
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions cmd/logs.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,10 @@ func describeCluster(ctx context.Context, client *ecs.Client, clusterId string)
if err != nil {
return nil, err
}
clustersCount := len(describedClusters.Clusters)
if clustersCount == 1 {
if len(describedClusters.Clusters) == 1 {
return &describedClusters.Clusters[0], nil
}
return nil, fmt.Errorf("expect 1 cluster, got %v", clustersCount)
return nil, fmt.Errorf("no cluster '%v' found", *selectedClusterId)
}

func selectClusterId(ctx context.Context, client *ecs.Client, clusterId string) (*string, error) {
Expand Down Expand Up @@ -138,11 +137,10 @@ func describeTask(ctx context.Context, client *ecs.Client, clusterId string, tas
if err != nil {
return nil, err
}
tasksCount := len(describedTasks.Tasks)
if tasksCount == 1 {
if len(describedTasks.Tasks) == 1 {
return &describedTasks.Tasks[0], nil
}
return nil, fmt.Errorf("expect 1 task, got %v", tasksCount)
return nil, fmt.Errorf("no task '%v' found", selectedTaskId)
}

func selectTaskId(ctx context.Context, client *ecs.Client, clusterId string, taskId string) (*string, error) {
Expand Down

0 comments on commit 9395e81

Please sign in to comment.