Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re-point those using BuildError from smithy-http to smithy-types #3070

Merged
merged 9 commits into from
Oct 19, 2023
8 changes: 8 additions & 0 deletions CHANGELOG.next.toml
Original file line number Diff line number Diff line change
Expand Up @@ -390,3 +390,11 @@ message = "[`PresignedRequest`](https://docs.rs/aws-sdk-s3/latest/aws_sdk_s3/pre
references = ["smithy-rs#3059"]
meta = { "breaking" = true, "tada" = false, "bug" = false }
author = "rcoh"

[[smithy-rs]]
message = """
`aws_smithy_http::operation::error::{BuildError, SerializationError}` have been moved to `aws_smithy_types::error::operation::{BuildError, SerializationError}`.
"""
references = ["smithy-rs#3054", "smithy-rs#3070"]
meta = { "breaking" = true, "tada" = false, "bug" = false, "target" = "all" }
author = "ysaito1001"
4 changes: 2 additions & 2 deletions aws/rust-runtime/aws-inlineable/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ aws-credential-types = { path = "../aws-credential-types" }
aws-http = { path = "../aws-http" }
aws-runtime = { path = "../aws-runtime" }
aws-sigv4 = { path = "../aws-sigv4" }
aws-smithy-async = { path = "../../../rust-runtime/aws-smithy-async", features = ["rt-tokio"] }
aws-smithy-checksums = { path = "../../../rust-runtime/aws-smithy-checksums" }
aws-smithy-http = { path = "../../../rust-runtime/aws-smithy-http" }
aws-smithy-runtime-api = { path = "../../../rust-runtime/aws-smithy-runtime-api", features = ["client"] }
aws-smithy-runtime = { path = "../../../rust-runtime/aws-smithy-runtime", features = ["client"] }
aws-smithy-runtime-api = { path = "../../../rust-runtime/aws-smithy-runtime-api", features = ["client"] }
aws-smithy-types = { path = "../../../rust-runtime/aws-smithy-types" }
aws-smithy-async = { path = "../../../rust-runtime/aws-smithy-async", features = ["rt-tokio"] }
bytes = "1"
hex = "0.4.3"
http = "0.2.9"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ use aws_sigv4::http_request::SignableBody;
use aws_smithy_checksums::ChecksumAlgorithm;
use aws_smithy_checksums::{body::calculate, http::HttpChecksum};
use aws_smithy_http::body::{BoxBody, SdkBody};
use aws_smithy_http::operation::error::BuildError;
use aws_smithy_runtime_api::box_error::BoxError;
use aws_smithy_runtime_api::client::interceptors::context::{
BeforeSerializationInterceptorContextRef, BeforeTransmitInterceptorContextMut, Input,
Expand All @@ -23,6 +22,7 @@ use aws_smithy_runtime_api::client::interceptors::Intercept;
use aws_smithy_runtime_api::client::orchestrator::HttpRequest;
use aws_smithy_runtime_api::client::runtime_components::RuntimeComponents;
use aws_smithy_types::config_bag::{ConfigBag, Layer, Storable, StoreReplace};
use aws_smithy_types::error::operation::BuildError;
use http::HeaderValue;
use http_body::Body;
use std::{fmt, mem};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
use aws_sdk_s3::config::{Credentials, Region};
use aws_sdk_s3::error::DisplayErrorContext;
use aws_sdk_s3::Client;
use aws_smithy_http::operation::error::BuildError;
use aws_smithy_runtime::client::http::test_util::capture_request;
use aws_smithy_types::error::operation::BuildError;

#[tokio::test]
async fn test_error_when_required_query_param_is_unset() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ sealed class BuilderSection(name: String) : Section(name) {
/** Customizations for BuilderGenerator */
abstract class BuilderCustomization : NamedCustomization<BuilderSection>()

fun RuntimeConfig.operationBuildError() = RuntimeType.operationModule(this).resolve("error::BuildError")
fun RuntimeConfig.serializationError() = RuntimeType.operationModule(this).resolve("error::SerializationError")
fun RuntimeConfig.operationBuildError() = RuntimeType.smithyTypes(this).resolve("error::operation::BuildError")
fun RuntimeConfig.serializationError() = RuntimeType.smithyTypes(this).resolve("error::operation::SerializationError")

fun MemberShape.enforceRequired(
field: Writable,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use thiserror::Error;
#[derive(Debug, Error)]
pub enum ResponseRejection {
#[error("error serializing JSON-encoded body: {0}")]
Serialization(#[from] aws_smithy_http::operation::error::SerializationError),
Serialization(#[from] aws_smithy_types::error::operation::SerializationError),
#[error("error building HTTP response: {0}")]
HttpBuild(#[from] http::Error),
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ pub enum ResponseRejection {
/// `httpHeader` or `httpPrefixHeaders`.
/// Used when failing to serialize an `httpPayload`-bound struct into an HTTP response body.
#[error("error building HTTP response: {0}")]
Build(#[from] aws_smithy_http::operation::error::BuildError),
Build(#[from] aws_smithy_types::error::operation::BuildError),

/// Used when failing to serialize a struct into a `String` for the JSON-encoded HTTP response
/// body.
Expand All @@ -76,7 +76,7 @@ pub enum ResponseRejection {
/// supplied timestamp is outside of the valid range when formatting using RFC-3339, i.e. a
/// date outside the `0001-01-01T00:00:00.000Z`-`9999-12-31T23:59:59.999Z` range is supplied.
#[error("error serializing JSON-encoded body: {0}")]
Serialization(#[from] aws_smithy_http::operation::error::SerializationError),
Serialization(#[from] aws_smithy_types::error::operation::SerializationError),

/// Used when consuming an [`http::response::Builder`] into the constructed [`http::Response`]
/// when calling [`http::response::Builder::body`].
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ pub enum ResponseRejection {
#[error("invalid bound HTTP status code; status codes must be inside the 100-999 range: {0}")]
InvalidHttpStatusCode(TryFromIntError),
#[error("error building HTTP response: {0}")]
Build(#[from] aws_smithy_http::operation::error::BuildError),
Build(#[from] aws_smithy_types::error::operation::BuildError),
#[error("error serializing XML-encoded body: {0}")]
Serialization(#[from] aws_smithy_http::operation::error::SerializationError),
Serialization(#[from] aws_smithy_types::error::operation::SerializationError),
#[error("error building HTTP response: {0}")]
HttpBuild(#[from] http::Error),
}
Expand Down
7 changes: 0 additions & 7 deletions rust-runtime/aws-smithy-http/src/operation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,6 @@
use aws_smithy_types::config_bag::{Storable, StoreReplace};
use std::borrow::Cow;

//TODO(runtimeCratesVersioningCleanup): Re-point those who use the following reexport to
// directly depend on `aws_smithy_types` and remove the reexport below.
/// Errors for operations
pub mod error {
pub use aws_smithy_types::error::operation::{BuildError, SerializationError};
}

ysaito1001 marked this conversation as resolved.
Show resolved Hide resolved
/// Metadata added to the [`ConfigBag`](aws_smithy_types::config_bag::ConfigBag) that identifies the API being called.
#[derive(Clone, Debug)]
pub struct Metadata {
Expand Down
Loading