File tree Expand file tree Collapse file tree 3 files changed +22
-6
lines changed Expand file tree Collapse file tree 3 files changed +22
-6
lines changed Original file line number Diff line number Diff line change 2222
2323namespace nix {
2424
25+ AwsAuthError::AwsAuthError (int errorCode)
26+ : Error(" AWS authentication error: '%s' (%d)" , aws_error_str(errorCode), errorCode)
27+ , errorCode(errorCode)
28+ {
29+ }
30+
2531namespace {
2632
2733static AwsCredentials getCredentialsFromProvider (std::shared_ptr<Aws::Crt::Auth::ICredentialsProvider> provider)
@@ -35,8 +41,7 @@ static AwsCredentials getCredentialsFromProvider(std::shared_ptr<Aws::Crt::Auth:
3541
3642 provider->GetCredentials ([prom](std::shared_ptr<Aws::Crt::Auth::Credentials> credentials, int errorCode) {
3743 if (errorCode != 0 || !credentials) {
38- prom->set_exception (
39- std::make_exception_ptr (AwsAuthError (" Failed to resolve AWS credentials: error code %d" , errorCode)));
44+ prom->set_exception (std::make_exception_ptr (AwsAuthError (errorCode)));
4045 } else {
4146 auto accessKeyId = Aws::Crt::ByteCursorToStringView (credentials->GetAccessKeyId ());
4247 auto secretAccessKey = Aws::Crt::ByteCursorToStringView (credentials->GetSecretAccessKey ());
Original file line number Diff line number Diff line change @@ -34,10 +34,19 @@ struct AwsCredentials
3434 }
3535};
3636
37- /* *
38- * Exception thrown when AWS authentication fails
39- */
40- MakeError (AwsAuthError, Error);
37+ class AwsAuthError : public Error
38+ {
39+ std::optional<int > errorCode;
40+
41+ public:
42+ using Error::Error;
43+ AwsAuthError (int errorCode);
44+
45+ std::optional<int > getErrorCode () const
46+ {
47+ return errorCode;
48+ }
49+ };
4150
4251class AwsCredentialProvider
4352{
Original file line number Diff line number Diff line change @@ -158,6 +158,8 @@ curl_s3_store_opt = get_option('curl-s3-store').require(
158158
159159if curl_s3_store_opt.enabled()
160160 deps_other += aws_crt_cpp
161+ aws_c_common = cxx.find_library (' aws-c-common' , required : true )
162+ deps_other += aws_c_common
161163endif
162164
163165configdata_pub.set(' NIX_WITH_AWS_AUTH' , curl_s3_store_opt.enabled().to_int())
You can’t perform that action at this time.
0 commit comments