| 83 | |
| 84 | template <typename ErrorType> |
| 85 | inline std::optional<std::string> BucketRegionFromError( |
| 86 | const Aws::Client::AWSError<ErrorType>& error) { |
| 87 | if constexpr (std::is_same_v<ErrorType, Aws::S3::S3Errors>) { |
| 88 | const auto& headers = error.GetResponseHeaders(); |
| 89 | const auto it = headers.find("x-amz-bucket-region"); |
| 90 | if (it != headers.end()) { |
| 91 | const std::string region(it->second.begin(), it->second.end()); |
| 92 | return region; |
| 93 | } |
| 94 | } |
| 95 | return std::nullopt; |
| 96 | } |
| 97 | |
| 98 | inline bool IsNotFound(const Aws::Client::AWSError<Aws::S3::S3Errors>& error) { |
| 99 | const auto error_type = error.GetErrorType(); |
no test coverage detected