From 0e88caf197b9688562f9d7743a68e73d9904dfba Mon Sep 17 00:00:00 2001 From: Gregory Szorc Date: Sat, 2 Nov 2024 17:47:42 -0700 Subject: [PATCH] apple-codesign: print S3 error context To help diagnose issues reported in #144. --- apple-codesign/CHANGELOG.md | 2 ++ apple-codesign/src/error.rs | 6 +++++- apple-codesign/src/notarization.rs | 7 +++++-- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/apple-codesign/CHANGELOG.md b/apple-codesign/CHANGELOG.md index 110b906c..f9b5b583 100644 --- a/apple-codesign/CHANGELOG.md +++ b/apple-codesign/CHANGELOG.md @@ -9,6 +9,8 @@ Released on ReleaseDate. * Fixed `env_logger` construction so `RUST_LOG` environment variable is respected. (#162) * MSRV 1.70 -> 1.78. +* Improve logging of S3 upload failures. We should now hopefully print something + more useful than `s3 upload error: unhandled error` on failures. * `aws-config` 1.1 -> 1.5. * `aws-sdk-s3` 1.12 -> 1.24. * `aws-smithy-types` 1.1 -> 1.2. diff --git a/apple-codesign/src/error.rs b/apple-codesign/src/error.rs index bdcd07b6..6682b09a 100644 --- a/apple-codesign/src/error.rs +++ b/apple-codesign/src/error.rs @@ -377,7 +377,11 @@ pub enum AppleCodesignError { #[cfg(feature = "notarize")] #[error("s3 upload error: {0}")] - AwsS3Error(Box), + AwsS3PutObject( + aws_smithy_types::error::display::DisplayErrorContext< + aws_sdk_s3::error::SdkError, + >, + ), #[error("bad time value")] BadTime, diff --git a/apple-codesign/src/notarization.rs b/apple-codesign/src/notarization.rs index ce4ff8c1..9116beef 100644 --- a/apple-codesign/src/notarization.rs +++ b/apple-codesign/src/notarization.rs @@ -329,8 +329,11 @@ impl Notarizer { .body(bytestream) .send(); - rt.block_on(fut) - .map_err(|e| AppleCodesignError::AwsS3Error(Box::new(aws_sdk_s3::Error::from(e))))?; + rt.block_on(fut).map_err(|e| { + AppleCodesignError::AwsS3PutObject( + aws_smithy_types::error::display::DisplayErrorContext(e), + ) + })?; warn!("S3 upload completed successfully");