Skip to content

Commit

Permalink
pubsys: surface AWS API service error code in error log
Browse files Browse the repository at this point in the history
This surfaces the actual AWS API service error code in the error log message.
  • Loading branch information
etungsten authored and jpmcb committed Mar 15, 2023
1 parent b1ac8ef commit 29d7d2f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
6 changes: 5 additions & 1 deletion tools/pubsys/src/aws/ami/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,11 @@ async fn _run(args: &Args, ami_args: &AmiArgs) -> Result<HashMap<String, Image>>
}
Err(e) => {
saw_error = true;
error!("Copy to {} failed: {}", region, e);
error!(
"Copy to {} failed: {}",
region,
e.into_service_error().code().unwrap_or("unknown")
);
}
}
}
Expand Down
18 changes: 11 additions & 7 deletions tools/pubsys/src/aws/publish_ami/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -399,12 +399,14 @@ pub(crate) async fn modify_regional_snapshots(
}
Err(e) => {
error_count += 1;
error!(
"Failed to modify permissions in {} for snapshots [{}]: {}",
region.as_ref(),
snapshot_ids.join(", "),
e
);
if let Error::ModifyImageAttribute { source: err, .. } = e {
error!(
"Failed to modify permissions in {} for snapshots [{}]: {:?}",
region.as_ref(),
snapshot_ids.join(", "),
err.into_service_error().code().unwrap_or("unknown"),
);
}
}
}
}
Expand Down Expand Up @@ -483,7 +485,9 @@ pub(crate) async fn modify_regional_images(
error_count += 1;
error!(
"Modifying permissions of {} in {} failed: {}",
image_id, region, e
image_id,
region,
e.into_service_error().code().unwrap_or("unknown"),
);
}
}
Expand Down

0 comments on commit 29d7d2f

Please sign in to comment.