Skip to content

Commit

Permalink
Improve error message on task not found
Browse files Browse the repository at this point in the history
  • Loading branch information
dalen committed Jul 24, 2018
1 parent 0c38d05 commit 95f9092
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,18 +169,23 @@ fn fetch_logs(
}

fn fetch_task(client: &EcsClient, cluster: &str, task: &rusoto_ecs::Task) -> rusoto_ecs::Task {
let task_arn = task.clone().task_arn.unwrap();

let result = client
.describe_tasks(&rusoto_ecs::DescribeTasksRequest {
cluster: Some(cluster.to_string()),
tasks: vec![task.clone().task_arn.unwrap()],
tasks: vec![task_arn.clone()],
})
.sync();
let tasks = result
.unwrap()
.tasks
.expect("Task definition response contained no tasks");
if tasks.len() == 0 {
panic!("Task definition contains no tasks")
panic!(format!(
"No task definitions matched cluster: {} arn: {}",
&cluster, &task_arn
))
} else {
tasks[0].clone()
}
Expand Down

0 comments on commit 95f9092

Please sign in to comment.