id stringlengths 22 133 | text stringlengths 40 40.2k | arch stringclasses 1
value | syntax stringclasses 1
value | kind stringclasses 4
values | repo stringclasses 27
values | path stringlengths 5 116 | license stringclasses 6
values | commit stringlengths 40 40 | source_host stringclasses 1
value | category stringclasses 16
values | source_url stringlengths 85 196 | line_start int64 1 4.28k | line_end int64 4 4.31k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/query_writer.rs:5 | }
}
if !problematic_chars.is_empty() {
panic!("we got some bad bytes here: {:#?}", problematic_chars)
}
}
#[test]
fn clear_params() {
let uri = Uri::from_static("http://www.example.com/path?original=here&foo=1");
let mut query_writer = QueryWriter::new(&... | rust | rust | rust-source | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/query_writer.rs | Apache-2.0 | 313e9a61491c69952cd176098967e46507b25fbc | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/313e9a61491c69952cd176098967e46507b25fbc/sdk/aws-smithy-http/src/query_writer.rs | 161 | 177 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/query_writer.rs:1 | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/
use crate::query::fmt_string as percent_encode_query;
use http_02x::uri::InvalidUri;
use http_02x::Uri;
/// Utility for updating the query string in a [`Uri`].
#[allow(missing_debug_implementations)]
pu... | rust | rust | rust-source | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/query_writer.rs | Apache-2.0 | b30f288c9f7dfdabd7bd6661ddeacf9f26a24871 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/b30f288c9f7dfdabd7bd6661ddeacf9f26a24871/sdk/aws-smithy-http/src/query_writer.rs | 1 | 60 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/query_writer.rs:2 | }
}
/// Clears all query parameters.
pub fn clear_params(&mut self) {
if let Some(index) = self.new_path_and_query.find('?') {
self.new_path_and_query.truncate(index);
self.prefix = Some('?');
}
}
/// Inserts a new query parameter. The key and value are perc... | rust | rust | rust-source | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/query_writer.rs | Apache-2.0 | b30f288c9f7dfdabd7bd6661ddeacf9f26a24871 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/b30f288c9f7dfdabd7bd6661ddeacf9f26a24871/sdk/aws-smithy-http/src/query_writer.rs | 41 | 100 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/query_writer.rs:3 | #[cfg(test)]
mod test {
use super::QueryWriter;
use http_02x::Uri;
#[test]
fn empty_uri() {
let uri = Uri::from_static("http://www.example.com");
let mut query_writer = QueryWriter::new(&uri);
query_writer.insert("key", "val%ue");
query_writer.insert("another", "value");... | rust | rust | rust-source | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/query_writer.rs | Apache-2.0 | b30f288c9f7dfdabd7bd6661ddeacf9f26a24871 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/b30f288c9f7dfdabd7bd6661ddeacf9f26a24871/sdk/aws-smithy-http/src/query_writer.rs | 81 | 140 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/query_writer.rs:4 | )
);
}
#[test]
fn build_query() {
let uri = Uri::from_static("http://www.example.com");
let mut query_writer = QueryWriter::new(&uri);
query_writer.insert("key", "val%ue");
query_writer.insert("ano%ther", "value");
assert_eq!("key=val%25ue&ano%25ther=value", ... | rust | rust | rust-source | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/query_writer.rs | Apache-2.0 | b30f288c9f7dfdabd7bd6661ddeacf9f26a24871 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/b30f288c9f7dfdabd7bd6661ddeacf9f26a24871/sdk/aws-smithy-http/src/query_writer.rs | 121 | 172 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/query_writer.rs:5 | }
}
#[test]
fn clear_params() {
let uri = Uri::from_static("http://www.example.com/path?original=here&foo=1");
let mut query_writer = QueryWriter::new(&uri);
query_writer.clear_params();
query_writer.insert("new", "value");
assert_eq!("new=value", query_writer.build_... | rust | rust | rust-source | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/query_writer.rs | Apache-2.0 | b30f288c9f7dfdabd7bd6661ddeacf9f26a24871 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/b30f288c9f7dfdabd7bd6661ddeacf9f26a24871/sdk/aws-smithy-http/src/query_writer.rs | 161 | 172 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/query_writer.rs:1 | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/
use crate::query::fmt_string as percent_encode_query;
use http::uri::InvalidUri;
use http::Uri;
/// Utility for updating the query string in a [`Uri`].
#[allow(missing_debug_implementations)]
pub struct... | rust | rust | rust-source | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/query_writer.rs | Apache-2.0 | 280e400ab518efd8db7992921dc5345d9d67dac5 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/280e400ab518efd8db7992921dc5345d9d67dac5/sdk/aws-smithy-http/src/query_writer.rs | 1 | 60 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/query_writer.rs:2 | }
}
/// Clears all query parameters.
pub fn clear_params(&mut self) {
if let Some(index) = self.new_path_and_query.find('?') {
self.new_path_and_query.truncate(index);
self.prefix = Some('?');
}
}
/// Inserts a new query parameter. The key and value are perc... | rust | rust | rust-source | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/query_writer.rs | Apache-2.0 | 280e400ab518efd8db7992921dc5345d9d67dac5 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/280e400ab518efd8db7992921dc5345d9d67dac5/sdk/aws-smithy-http/src/query_writer.rs | 41 | 100 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/query_writer.rs:3 | #[cfg(test)]
mod test {
use super::QueryWriter;
use http::Uri;
#[test]
fn empty_uri() {
let uri = Uri::from_static("http://www.example.com");
let mut query_writer = QueryWriter::new(&uri);
query_writer.insert("key", "val%ue");
query_writer.insert("another", "value");
... | rust | rust | rust-source | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/query_writer.rs | Apache-2.0 | 280e400ab518efd8db7992921dc5345d9d67dac5 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/280e400ab518efd8db7992921dc5345d9d67dac5/sdk/aws-smithy-http/src/query_writer.rs | 81 | 140 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/query_writer.rs:1 | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/
use crate::query::fmt_string as percent_encode_query;
use http::Uri;
/// Utility for updating the query string in a [`Uri`].
#[allow(missing_debug_implementations)]
pub struct QueryWriter {
base_uri... | rust | rust | rust-source | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/query_writer.rs | Apache-2.0 | 2b4a7b881b8735aad288284e1c140ed40f474d06 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/2b4a7b881b8735aad288284e1c140ed40f474d06/sdk/aws-smithy-http/src/query_writer.rs | 1 | 60 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/query_writer.rs:2 | self.new_path_and_query.truncate(index);
self.prefix = Some('?');
}
}
/// Inserts a new query parameter. The key and value are percent encoded
/// by `QueryWriter`. Passing in percent encoded values will result in double encoding.
pub fn insert(&mut self, k: &str, v: &str) {
... | rust | rust | rust-source | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/query_writer.rs | Apache-2.0 | 2b4a7b881b8735aad288284e1c140ed40f474d06 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/2b4a7b881b8735aad288284e1c140ed40f474d06/sdk/aws-smithy-http/src/query_writer.rs | 41 | 100 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/query_writer.rs:3 | #[test]
fn empty_uri() {
let uri = Uri::from_static("http://www.example.com");
let mut query_writer = QueryWriter::new(&uri);
query_writer.insert("key", "val%ue");
query_writer.insert("another", "value");
assert_eq!(
query_writer.build_uri(),
Uri::from... | rust | rust | rust-source | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/query_writer.rs | Apache-2.0 | 2b4a7b881b8735aad288284e1c140ed40f474d06 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/2b4a7b881b8735aad288284e1c140ed40f474d06/sdk/aws-smithy-http/src/query_writer.rs | 81 | 140 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/query_writer.rs:4 | let uri = Uri::from_static("http://www.example.com");
let mut query_writer = QueryWriter::new(&uri);
query_writer.insert("key", "val%ue");
query_writer.insert("ano%ther", "value");
assert_eq!("key=val%25ue&ano%25ther=value", query_writer.build_query());
}
#[test]
// This tes... | rust | rust | rust-source | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/query_writer.rs | Apache-2.0 | 2b4a7b881b8735aad288284e1c140ed40f474d06 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/2b4a7b881b8735aad288284e1c140ed40f474d06/sdk/aws-smithy-http/src/query_writer.rs | 121 | 166 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/response.rs:2 | /// handler to take ownership of the HTTP response directly.
///
/// Currently `parse_unloaded` operates on a borrowed HTTP request to enable
/// the caller to provide a raw HTTP response to the caller for inspection after the response is
/// returned. For EventStream-like use cases, the caller can use ... | rust | rust | rust-source | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/response.rs | Apache-2.0 | f392e8cd65b26fe82a5fb464927e7ecb7c2b36d6 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/f392e8cd65b26fe82a5fb464927e7ecb7c2b36d6/sdk/aws-smithy-http/src/response.rs | 41 | 100 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/response.rs:3 | fn parse(&self, response: &http::Response<Bytes>) -> Self::Output;
/// Returns whether the contents of this response are sensitive
///
/// When this is set to true, wire logging will be disabled
fn sensitive(&self) -> bool {
false
}
}
impl<T: ParseStrictResponse> ParseHttpResponse for T {
... | rust | rust | rust-source | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/response.rs | Apache-2.0 | f392e8cd65b26fe82a5fb464927e7ecb7c2b36d6 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/f392e8cd65b26fe82a5fb464927e7ecb7c2b36d6/sdk/aws-smithy-http/src/response.rs | 81 | 137 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/response.rs:4 | struct S3GetObjectParser;
impl ParseHttpResponse for S3GetObjectParser {
type Output = S3GetObject;
fn parse_unloaded(&self, response: &mut operation::Response) -> Option<Self::Output> {
// For responses that pass on the body, use mem::take to leave behind an empty body... | rust | rust | rust-source | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/response.rs | Apache-2.0 | f392e8cd65b26fe82a5fb464927e7ecb7c2b36d6 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/f392e8cd65b26fe82a5fb464927e7ecb7c2b36d6/sdk/aws-smithy-http/src/response.rs | 121 | 137 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/response.rs:2 | /// handler to take ownership of the HTTP response directly.
///
/// Currently `parse_unloaded` operates on a borrowed HTTP request to enable
/// the caller to provide a raw HTTP response to the caller for inspection after the response is
/// returned. For EventStream-like use cases, the caller can use ... | rust | rust | rust-source | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/response.rs | Apache-2.0 | 2b4a7b881b8735aad288284e1c140ed40f474d06 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/2b4a7b881b8735aad288284e1c140ed40f474d06/sdk/aws-smithy-http/src/response.rs | 41 | 100 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/response.rs:3 | None
}
fn parse_loaded(&self, response: &http::Response<Bytes>) -> Self::Output {
self.parse(response)
}
}
#[cfg(test)]
mod test {
use crate::body::SdkBody;
use crate::operation;
use crate::response::ParseHttpResponse;
use bytes::Bytes;
use std::mem;
#[test]
fn support... | rust | rust | rust-source | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/response.rs | Apache-2.0 | 2b4a7b881b8735aad288284e1c140ed40f474d06 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/2b4a7b881b8735aad288284e1c140ed40f474d06/sdk/aws-smithy-http/src/response.rs | 81 | 119 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/response.rs:2 | /// Currently `parse_unloaded` operates on a borrowed HTTP request to enable
/// the caller to provide a raw HTTP response to the caller for inspection after the response is
/// returned. For EventStream-like use cases, the caller can use `mem::swap` to replace
/// the streaming body with an empty body as l... | rust | rust | rust-source | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/response.rs | Apache-2.0 | 8159cb8ff570e4dca718e354c31cecdfadfeb0b8 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/8159cb8ff570e4dca718e354c31cecdfadfeb0b8/sdk/aws-smithy-http/src/response.rs | 41 | 100 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/response.rs:3 | }
}
#[cfg(test)]
mod test {
use crate::body::SdkBody;
use crate::operation;
use crate::response::ParseHttpResponse;
use bytes::Bytes;
use std::mem;
#[test]
fn supports_streaming_body() {
pub struct S3GetObject {
pub body: SdkBody,
}
struct S3GetObjectPa... | rust | rust | rust-source | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/response.rs | Apache-2.0 | 8159cb8ff570e4dca718e354c31cecdfadfeb0b8 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/8159cb8ff570e4dca718e354c31cecdfadfeb0b8/sdk/aws-smithy-http/src/response.rs | 81 | 114 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/result.rs:1 | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/
//TODO(runtimeCratesVersioningCleanup): Keep the following deprecated type aliases for at least
// one release since 0.56.1 and then remove this module.
//! Types for [`error`](aws_smithy_runtime_api::c... | rust | rust | rust-source | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/result.rs | Apache-2.0 | 0ff4059b2486642feaa9d8354e64cac48ff02e56 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/0ff4059b2486642feaa9d8354e64cac48ff02e56/sdk/aws-smithy-http/src/result.rs | 1 | 60 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/result.rs:2 | /// Builder for [`ServiceError`](aws_smithy_runtime_api::client::result::ServiceError).
#[deprecated(
note = "Moved to `aws_smithy_runtime_api::client::result::builders::ServiceErrorBuilder`."
)]
pub type ServiceErrorBuilder<E, R> =
aws_smithy_runtime_api::client::result::builders::ServiceEr... | rust | rust | rust-source | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/result.rs | Apache-2.0 | 0ff4059b2486642feaa9d8354e64cac48ff02e56 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/0ff4059b2486642feaa9d8354e64cac48ff02e56/sdk/aws-smithy-http/src/result.rs | 41 | 75 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/result.rs:1 | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/
//! Types for [error](SdkError) responses.
use crate::connection::ConnectionMetadata;
use aws_smithy_types::body::SdkBody;
use aws_smithy_types::error::metadata::{ProvideErrorMetadata, EMPTY_ERROR_METAD... | rust | rust | macro-heavy | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/result.rs | Apache-2.0 | 882646f33ed8ca91a1541be0bcbd390545f04a99 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/882646f33ed8ca91a1541be0bcbd390545f04a99/sdk/aws-smithy-http/src/result.rs | 1 | 60 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/result.rs:8 | pub fn err(&self) -> &E {
&self.source
}
/// Converts this error context into the underlying error `E`
pub fn into_err(self) -> E {
self.source
}
/// Returns a reference to the raw response
pub fn raw(&self) -> &R {
&self.raw
}
/// Converts this error context i... | rust | rust | macro-heavy | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/result.rs | Apache-2.0 | 882646f33ed8ca91a1541be0bcbd390545f04a99 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/882646f33ed8ca91a1541be0bcbd390545f04a99/sdk/aws-smithy-http/src/result.rs | 281 | 340 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/result.rs:10 | Self::ResponseError(ResponseError {
source: source.into(),
raw,
})
}
/// Construct a `SdkError` for a service failure
pub fn service_error(source: E, raw: R) -> Self {
Self::ServiceError(ServiceError { source, raw })
}
/// Returns the underlying service erro... | rust | rust | macro-heavy | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/result.rs | Apache-2.0 | 882646f33ed8ca91a1541be0bcbd390545f04a99 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/882646f33ed8ca91a1541be0bcbd390545f04a99/sdk/aws-smithy-http/src/result.rs | 361 | 420 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/result.rs:11 | /// # Ok(())
/// # }
/// ```
pub fn into_service_error(self) -> E
where
E: std::error::Error + Send + Sync + CreateUnhandledError + 'static,
R: Debug + Send + Sync + 'static,
{
match self {
Self::ServiceError(context) => context.source,
_ => E::create_... | rust | rust | macro-heavy | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/result.rs | Apache-2.0 | 882646f33ed8ca91a1541be0bcbd390545f04a99 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/882646f33ed8ca91a1541be0bcbd390545f04a99/sdk/aws-smithy-http/src/result.rs | 401 | 460 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/result.rs:12 | /// Maps the service error type in `SdkError::ServiceError`
#[doc(hidden)]
pub fn map_service_error<E2>(self, map: impl FnOnce(E) -> E2) -> SdkError<E2, R> {
match self {
Self::ServiceError(context) => SdkError::<E2, R>::ServiceError(ServiceError {
source: map(context.source)... | rust | rust | macro-heavy | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/result.rs | Apache-2.0 | 882646f33ed8ca91a1541be0bcbd390545f04a99 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/882646f33ed8ca91a1541be0bcbd390545f04a99/sdk/aws-smithy-http/src/result.rs | 441 | 500 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/result.rs:13 | ServiceError(context) => Some(&context.source),
}
}
}
impl<E, R> ProvideErrorMetadata for SdkError<E, R>
where
E: ProvideErrorMetadata,
{
fn meta(&self) -> &aws_smithy_types::Error {
match self {
Self::ConstructionFailure(_) => &EMPTY_ERROR_METADATA,
Self::TimeoutErr... | rust | rust | macro-heavy | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/result.rs | Apache-2.0 | 882646f33ed8ca91a1541be0bcbd390545f04a99 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/882646f33ed8ca91a1541be0bcbd390545f04a99/sdk/aws-smithy-http/src/result.rs | 481 | 540 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/result.rs:14 | /// connector error.
#[derive(Debug)]
pub struct ConnectorError {
kind: ConnectorErrorKind,
source: BoxError,
connection: ConnectionStatus,
}
#[non_exhaustive]
#[derive(Debug)]
pub(crate) enum ConnectionStatus {
/// This request was never connected to the remote
///
/// This indicates the failu... | rust | rust | macro-heavy | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/result.rs | Apache-2.0 | 882646f33ed8ca91a1541be0bcbd390545f04a99 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/882646f33ed8ca91a1541be0bcbd390545f04a99/sdk/aws-smithy-http/src/result.rs | 521 | 580 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/result.rs:15 | impl ConnectorError {
/// Construct a [`ConnectorError`] from an error caused by a timeout
///
/// Timeout errors are typically retried on a new connection.
pub fn timeout(source: BoxError) -> Self {
Self {
kind: ConnectorErrorKind::Timeout,
source,
connection... | rust | rust | macro-heavy | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/result.rs | Apache-2.0 | 882646f33ed8ca91a1541be0bcbd390545f04a99 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/882646f33ed8ca91a1541be0bcbd390545f04a99/sdk/aws-smithy-http/src/result.rs | 561 | 620 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/result.rs:16 | }
/// Construct a [`ConnectorError`] from an different unclassified error.
///
/// Optionally, an explicit `Kind` may be passed.
pub fn other(source: BoxError, kind: Option<ErrorKind>) -> Self {
Self {
source,
kind: ConnectorErrorKind::Other(kind),
connection... | rust | rust | macro-heavy | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/result.rs | Apache-2.0 | 882646f33ed8ca91a1541be0bcbd390545f04a99 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/882646f33ed8ca91a1541be0bcbd390545f04a99/sdk/aws-smithy-http/src/result.rs | 601 | 658 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/result.rs:1 | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/
//! Types for [error](SdkError) responses.
use crate::body::SdkBody;
use crate::connection::ConnectionMetadata;
use aws_smithy_types::error::metadata::{ProvideErrorMetadata, EMPTY_ERROR_METADATA};
use a... | rust | rust | macro-heavy | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/result.rs | Apache-2.0 | ca86e98f9331d4e6ae08a736fe3e1458ab4a03d7 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/ca86e98f9331d4e6ae08a736fe3e1458ab4a03d7/sdk/aws-smithy-http/src/result.rs | 1 | 60 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/result.rs:1 | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/
//! `Result` wrapper types for [success](SdkSuccess) and [failure](SdkError) responses.
use std::error::Error;
use std::fmt;
use std::fmt::{Debug, Display, Formatter};
use aws_smithy_types::error::meta... | rust | rust | macro-heavy | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/result.rs | Apache-2.0 | 55aa7275a4a080ca6c3b74b77d5f86d37dbb7720 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/55aa7275a4a080ca6c3b74b77d5f86d37dbb7720/sdk/aws-smithy-http/src/result.rs | 1 | 60 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/result.rs:2 | }
impl $builderName {
#[doc = "Creates a new builder."]
pub fn new() -> Self { Default::default() }
#[doc = "Sets the error source."]
pub fn source(mut self, source: impl Into<$sourceType>) -> Self {
self.source = Some(sou... | rust | rust | macro-heavy | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/result.rs | Apache-2.0 | 55aa7275a4a080ca6c3b74b77d5f86d37dbb7720 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/55aa7275a4a080ca6c3b74b77d5f86d37dbb7720/sdk/aws-smithy-http/src/result.rs | 41 | 100 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/result.rs:3 | source: None,
raw: None,
}
}
}
impl<R> ResponseErrorBuilder<R> {
/// Creates a new builder.
pub fn new() -> Self {
Default::default()
}
/// Sets the error source.
pub fn source(mut self, source: impl Into<BoxError>) -> Sel... | rust | rust | macro-heavy | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/result.rs | Apache-2.0 | 55aa7275a4a080ca6c3b74b77d5f86d37dbb7720 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/55aa7275a4a080ca6c3b74b77d5f86d37dbb7720/sdk/aws-smithy-http/src/result.rs | 81 | 140 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/result.rs:4 | raw: self.raw.expect("a raw response is required"),
}
}
}
/// Builder for [`ServiceError`](super::ServiceError).
#[derive(Debug)]
pub struct ServiceErrorBuilder<E, R> {
source: Option<E>,
raw: Option<R>,
}
impl<E, R> Default for ServiceErrorBuilder<E, R> {
... | rust | rust | macro-heavy | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/result.rs | Apache-2.0 | 55aa7275a4a080ca6c3b74b77d5f86d37dbb7720 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/55aa7275a4a080ca6c3b74b77d5f86d37dbb7720/sdk/aws-smithy-http/src/result.rs | 121 | 180 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/result.rs:5 | pub fn raw(mut self, raw: R) -> Self {
self.raw = Some(raw);
self
}
/// Sets the raw response.
pub fn set_raw(&mut self, raw: Option<R>) -> &mut Self {
self.raw = raw;
self
}
/// Builds the error context.
pub fn build(self... | rust | rust | macro-heavy | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/result.rs | Apache-2.0 | 55aa7275a4a080ca6c3b74b77d5f86d37dbb7720 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/55aa7275a4a080ca6c3b74b77d5f86d37dbb7720/sdk/aws-smithy-http/src/result.rs | 161 | 220 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/result.rs:6 | impl TimeoutError {
/// Creates a builder for this error context type.
pub fn builder() -> builders::TimeoutErrorBuilder {
builders::TimeoutErrorBuilder::new()
}
}
/// Error context for [`SdkError::DispatchFailure`]
#[derive(Debug)]
pub struct DispatchFailure {
source: ConnectorError,
}
impl D... | rust | rust | macro-heavy | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/result.rs | Apache-2.0 | 55aa7275a4a080ca6c3b74b77d5f86d37dbb7720 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/55aa7275a4a080ca6c3b74b77d5f86d37dbb7720/sdk/aws-smithy-http/src/result.rs | 201 | 260 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/result.rs:7 | pub fn as_other(&self) -> Option<ErrorKind> {
self.source.as_other()
}
/// Returns the inner error if it is a connector error
pub fn as_connector_error(&self) -> Option<&ConnectorError> {
Some(&self.source)
}
}
/// Error context for [`SdkError::ResponseError`]
#[derive(Debug)]
pub stru... | rust | rust | macro-heavy | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/result.rs | Apache-2.0 | 55aa7275a4a080ca6c3b74b77d5f86d37dbb7720 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/55aa7275a4a080ca6c3b74b77d5f86d37dbb7720/sdk/aws-smithy-http/src/result.rs | 241 | 300 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/result.rs:8 | source: E,
/// Raw response from the service
raw: R,
}
impl<E, R> ServiceError<E, R> {
/// Creates a builder for this error context type.
pub fn builder() -> builders::ServiceErrorBuilder<E, R> {
builders::ServiceErrorBuilder::new()
}
/// Returns the underlying error of type `E`
pu... | rust | rust | macro-heavy | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/result.rs | Apache-2.0 | 55aa7275a4a080ca6c3b74b77d5f86d37dbb7720 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/55aa7275a4a080ca6c3b74b77d5f86d37dbb7720/sdk/aws-smithy-http/src/result.rs | 281 | 340 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/result.rs:9 | ) -> Self;
}
/// Failed SDK Result
///
/// When logging an error from the SDK, it is recommended that you either wrap the error in
/// [`DisplayErrorContext`](aws_smithy_types::error::display::DisplayErrorContext), use another
/// error reporter library that visits the error's cause/source chain, or call
/// [`Error::... | rust | rust | macro-heavy | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/result.rs | Apache-2.0 | 55aa7275a4a080ca6c3b74b77d5f86d37dbb7720 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/55aa7275a4a080ca6c3b74b77d5f86d37dbb7720/sdk/aws-smithy-http/src/result.rs | 321 | 380 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/result.rs:10 | Self::TimeoutError(TimeoutError {
source: source.into(),
})
}
/// Construct a `SdkError` for a dispatch failure with a [`ConnectorError`]
pub fn dispatch_failure(source: ConnectorError) -> Self {
Self::DispatchFailure(DispatchFailure { source })
}
/// Construct a `SdkEr... | rust | rust | macro-heavy | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/result.rs | Apache-2.0 | 55aa7275a4a080ca6c3b74b77d5f86d37dbb7720 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/55aa7275a4a080ca6c3b74b77d5f86d37dbb7720/sdk/aws-smithy-http/src/result.rs | 361 | 420 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/result.rs:11 | /// # _: Box<dyn std::error::Error + Send + Sync + 'static>,
/// # _: Option<aws_smithy_types::error::ErrorMetadata>,
/// # ) -> Self { unimplemented!() }
/// # }
/// # fn example() -> Result<(), GetObjectError> {
/// # let sdk_err = SdkError::service_error(GetObjectError::NoSuch... | rust | rust | macro-heavy | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/result.rs | Apache-2.0 | 55aa7275a4a080ca6c3b74b77d5f86d37dbb7720 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/55aa7275a4a080ca6c3b74b77d5f86d37dbb7720/sdk/aws-smithy-http/src/result.rs | 401 | 460 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/result.rs:12 | }
}
/// Return a reference to this error's raw response, if it contains one. Otherwise, return `None`.
pub fn raw_response(&self) -> Option<&R> {
match self {
Self::ServiceError(inner) => Some(inner.raw()),
Self::ResponseError(inner) => Some(inner.raw()),
_ => No... | rust | rust | macro-heavy | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/result.rs | Apache-2.0 | 55aa7275a4a080ca6c3b74b77d5f86d37dbb7720 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/55aa7275a4a080ca6c3b74b77d5f86d37dbb7720/sdk/aws-smithy-http/src/result.rs | 441 | 500 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/result.rs:13 | impl<E, R> Error for SdkError<E, R>
where
E: Error + 'static,
R: Debug,
{
fn source(&self) -> Option<&(dyn Error + 'static)> {
use SdkError::*;
match self {
ConstructionFailure(context) => Some(context.source.as_ref()),
TimeoutError(context) => Some(context.source.as_... | rust | rust | macro-heavy | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/result.rs | Apache-2.0 | 55aa7275a4a080ca6c3b74b77d5f86d37dbb7720 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/55aa7275a4a080ca6c3b74b77d5f86d37dbb7720/sdk/aws-smithy-http/src/result.rs | 481 | 540 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/result.rs:14 | /// Socket/IO error
Io,
/// An unclassified Error with an explicit error kind
Other(Option<ErrorKind>),
}
/// Error from the underlying Connector
///
/// Connector exists to attach a `ConnectorErrorKind` to what would otherwise be an opaque `Box<dyn Error>`
/// that comes off a potentially generic or dyna... | rust | rust | macro-heavy | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/result.rs | Apache-2.0 | 55aa7275a4a080ca6c3b74b77d5f86d37dbb7720 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/55aa7275a4a080ca6c3b74b77d5f86d37dbb7720/sdk/aws-smithy-http/src/result.rs | 521 | 580 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/result.rs:15 | ConnectorErrorKind::Io => write!(f, "io error"),
ConnectorErrorKind::Other(_) => write!(f, "other"),
}
}
}
impl Error for ConnectorError {
fn source(&self) -> Option<&(dyn Error + 'static)> {
Some(self.source.as_ref())
}
}
impl ConnectorError {
/// Construct a [`ConnectorEr... | rust | rust | macro-heavy | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/result.rs | Apache-2.0 | 55aa7275a4a080ca6c3b74b77d5f86d37dbb7720 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/55aa7275a4a080ca6c3b74b77d5f86d37dbb7720/sdk/aws-smithy-http/src/result.rs | 561 | 620 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/result.rs:16 | source,
connection: ConnectionStatus::Unknown,
}
}
/// Construct a [`ConnectorError`] from an IO related error (e.g. socket hangup)
pub fn io(source: BoxError) -> Self {
Self {
kind: ConnectorErrorKind::Io,
source,
connection: ConnectionStatus... | rust | rust | macro-heavy | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/result.rs | Apache-2.0 | 55aa7275a4a080ca6c3b74b77d5f86d37dbb7720 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/55aa7275a4a080ca6c3b74b77d5f86d37dbb7720/sdk/aws-smithy-http/src/result.rs | 601 | 660 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/result.rs:17 | /// Returns true if the error is an unclassified error.
pub fn is_other(&self) -> bool {
matches!(self.kind, ConnectorErrorKind::Other(..))
}
/// Returns the optional error kind associated with an unclassified error
pub fn as_other(&self) -> Option<ErrorKind> {
match &self.kind {
... | rust | rust | macro-heavy | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/result.rs | Apache-2.0 | 55aa7275a4a080ca6c3b74b77d5f86d37dbb7720 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/55aa7275a4a080ca6c3b74b77d5f86d37dbb7720/sdk/aws-smithy-http/src/result.rs | 641 | 670 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/result.rs:16 | source,
connection: ConnectionStatus::Unknown,
}
}
/// Construct a [`ConnectorError`] from an IO related error (e.g. socket hangup)
pub fn io(source: BoxError) -> Self {
Self {
kind: ConnectorErrorKind::Io,
source,
connection: ConnectionStatus... | rust | rust | macro-heavy | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/result.rs | Apache-2.0 | ce28848a2f73a8ba0c4b526135983ce8ef19255e | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/ce28848a2f73a8ba0c4b526135983ce8ef19255e/sdk/aws-smithy-http/src/result.rs | 601 | 660 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/result.rs:17 | /// Returns true if the error is an unclassified error.
pub fn is_other(&self) -> bool {
matches!(self.kind, ConnectorErrorKind::Other(..))
}
/// Returns the optional error kind associated with an unclassified error
pub fn as_other(&self) -> Option<ErrorKind> {
match &self.kind {
... | rust | rust | macro-heavy | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/result.rs | Apache-2.0 | ce28848a2f73a8ba0c4b526135983ce8ef19255e | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/ce28848a2f73a8ba0c4b526135983ce8ef19255e/sdk/aws-smithy-http/src/result.rs | 641 | 665 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/result.rs:6 | impl TimeoutError {
/// Creates a builder for this error context type.
pub fn builder() -> builders::TimeoutErrorBuilder {
builders::TimeoutErrorBuilder::new()
}
}
/// Error context for [`SdkError::DispatchFailure`]
#[derive(Debug)]
pub struct DispatchFailure {
source: ConnectorError,
}
impl D... | rust | rust | macro-heavy | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/result.rs | Apache-2.0 | 591369a128c887739a4c5475db20904687de1fab | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/591369a128c887739a4c5475db20904687de1fab/sdk/aws-smithy-http/src/result.rs | 201 | 260 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/result.rs:7 | pub fn as_connector_error(&self) -> Option<&ConnectorError> {
Some(&self.source)
}
}
/// Error context for [`SdkError::ResponseError`]
#[derive(Debug)]
pub struct ResponseError<R> {
/// Error encountered while parsing the response
source: BoxError,
/// Raw response that was available
raw: R... | rust | rust | macro-heavy | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/result.rs | Apache-2.0 | 591369a128c887739a4c5475db20904687de1fab | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/591369a128c887739a4c5475db20904687de1fab/sdk/aws-smithy-http/src/result.rs | 241 | 300 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/result.rs:8 | impl<E, R> ServiceError<E, R> {
/// Creates a builder for this error context type.
pub fn builder() -> builders::ServiceErrorBuilder<E, R> {
builders::ServiceErrorBuilder::new()
}
/// Returns the underlying error of type `E`
pub fn err(&self) -> &E {
&self.source
}
/// Conv... | rust | rust | macro-heavy | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/result.rs | Apache-2.0 | 591369a128c887739a4c5475db20904687de1fab | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/591369a128c887739a4c5475db20904687de1fab/sdk/aws-smithy-http/src/result.rs | 281 | 340 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/result.rs:9 | /// When logging an error from the SDK, it is recommended that you either wrap the error in
/// [`DisplayErrorContext`](aws_smithy_types::error::display::DisplayErrorContext), use another
/// error reporter library that visits the error's cause/source chain, or call
/// [`Error::source`](std::error::Error::source) for ... | rust | rust | macro-heavy | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/result.rs | Apache-2.0 | 591369a128c887739a4c5475db20904687de1fab | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/591369a128c887739a4c5475db20904687de1fab/sdk/aws-smithy-http/src/result.rs | 321 | 380 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/result.rs:10 | /// Construct a `SdkError` for a dispatch failure with a [`ConnectorError`]
pub fn dispatch_failure(source: ConnectorError) -> Self {
Self::DispatchFailure(DispatchFailure { source })
}
/// Construct a `SdkError` for a response error
pub fn response_error(source: impl Into<BoxError>, raw: R) ->... | rust | rust | macro-heavy | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/result.rs | Apache-2.0 | 591369a128c887739a4c5475db20904687de1fab | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/591369a128c887739a4c5475db20904687de1fab/sdk/aws-smithy-http/src/result.rs | 361 | 420 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/result.rs:11 | /// # let sdk_err = SdkError::service_error(GetObjectError::NoSuchKey(()), ());
/// match sdk_err.into_service_error() {
/// GetObjectError::NoSuchKey(_) => {
/// // handle NoSuchKey
/// }
/// err @ _ => return Err(err),
/// }
/// # Ok(())
/// # }
/// ```
pub ... | rust | rust | macro-heavy | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/result.rs | Apache-2.0 | 591369a128c887739a4c5475db20904687de1fab | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/591369a128c887739a4c5475db20904687de1fab/sdk/aws-smithy-http/src/result.rs | 401 | 460 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/result.rs:12 | match self {
Self::ServiceError(inner) => Some(inner.raw()),
Self::ResponseError(inner) => Some(inner.raw()),
_ => None,
}
}
/// Maps the service error type in `SdkError::ServiceError`
#[doc(hidden)]
pub fn map_service_error<E2>(self, map: impl FnOnce(E) -> E... | rust | rust | macro-heavy | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/result.rs | Apache-2.0 | 591369a128c887739a4c5475db20904687de1fab | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/591369a128c887739a4c5475db20904687de1fab/sdk/aws-smithy-http/src/result.rs | 441 | 500 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/result.rs:13 | fn source(&self) -> Option<&(dyn Error + 'static)> {
use SdkError::*;
match self {
ConstructionFailure(context) => Some(context.source.as_ref()),
TimeoutError(context) => Some(context.source.as_ref()),
ResponseError(context) => Some(context.source.as_ref()),
... | rust | rust | macro-heavy | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/result.rs | Apache-2.0 | 591369a128c887739a4c5475db20904687de1fab | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/591369a128c887739a4c5475db20904687de1fab/sdk/aws-smithy-http/src/result.rs | 481 | 540 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/result.rs:14 | }
/// Error from the underlying Connector
///
/// Connector exists to attach a `ConnectorErrorKind` to what would otherwise be an opaque `Box<dyn Error>`
/// that comes off a potentially generic or dynamic connector.
/// The attached `kind` is used to determine what retry behavior should occur (if any) based on the
//... | rust | rust | macro-heavy | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/result.rs | Apache-2.0 | 591369a128c887739a4c5475db20904687de1fab | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/591369a128c887739a4c5475db20904687de1fab/sdk/aws-smithy-http/src/result.rs | 521 | 580 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/result.rs:15 | impl Error for ConnectorError {
fn source(&self) -> Option<&(dyn Error + 'static)> {
Some(self.source.as_ref())
}
}
impl ConnectorError {
/// Construct a [`ConnectorError`] from an error caused by a timeout
///
/// Timeout errors are typically retried on a new connection.
pub fn timeout... | rust | rust | macro-heavy | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/result.rs | Apache-2.0 | 591369a128c887739a4c5475db20904687de1fab | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/591369a128c887739a4c5475db20904687de1fab/sdk/aws-smithy-http/src/result.rs | 561 | 620 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/result.rs:16 | /// Construct a [`ConnectorError`] from an IO related error (e.g. socket hangup)
pub fn io(source: BoxError) -> Self {
Self {
kind: ConnectorErrorKind::Io,
source,
connection: ConnectionStatus::Unknown,
}
}
/// Construct a [`ConnectorError`] from an diffe... | rust | rust | macro-heavy | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/result.rs | Apache-2.0 | 591369a128c887739a4c5475db20904687de1fab | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/591369a128c887739a4c5475db20904687de1fab/sdk/aws-smithy-http/src/result.rs | 601 | 655 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/result.rs:17 | }
}
/// Returns metadata about the connection
///
/// If a connection was established and provided by the internal connector, a connection will
/// be returned.
pub fn connection_metadata(&self) -> Option<&ConnectionMetadata> {
match &self.connection {
ConnectionStatus::Neve... | rust | rust | macro-heavy | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/result.rs | Apache-2.0 | 591369a128c887739a4c5475db20904687de1fab | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/591369a128c887739a4c5475db20904687de1fab/sdk/aws-smithy-http/src/result.rs | 641 | 655 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/result.rs:1 | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/
//! `Result` wrapper types for [success](SdkSuccess) and [failure](SdkError) responses.
use crate::connection::ConnectionMetadata;
use crate::operation;
use aws_smithy_types::error::metadata::{ProvideEr... | rust | rust | macro-heavy | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/result.rs | Apache-2.0 | 859d18e93f161db478e19f9db7e21ba30092426e | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/859d18e93f161db478e19f9db7e21ba30092426e/sdk/aws-smithy-http/src/result.rs | 1 | 60 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/result.rs:2 | impl $builderName {
#[doc = "Creates a new builder."]
pub fn new() -> Self { Default::default() }
#[doc = "Sets the error source."]
pub fn source(mut self, source: impl Into<$sourceType>) -> Self {
self.source = Some(source.into());
... | rust | rust | macro-heavy | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/result.rs | Apache-2.0 | 859d18e93f161db478e19f9db7e21ba30092426e | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/859d18e93f161db478e19f9db7e21ba30092426e/sdk/aws-smithy-http/src/result.rs | 41 | 100 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/result.rs:3 | }
}
}
impl<R> ResponseErrorBuilder<R> {
/// Creates a new builder.
pub fn new() -> Self {
Default::default()
}
/// Sets the error source.
pub fn source(mut self, source: impl Into<BoxError>) -> Self {
self.source = Some(source.into());
... | rust | rust | macro-heavy | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/result.rs | Apache-2.0 | 859d18e93f161db478e19f9db7e21ba30092426e | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/859d18e93f161db478e19f9db7e21ba30092426e/sdk/aws-smithy-http/src/result.rs | 81 | 140 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/result.rs:4 | }
}
/// Builder for [`ServiceError`](super::ServiceError).
#[derive(Debug)]
pub struct ServiceErrorBuilder<E, R> {
source: Option<E>,
raw: Option<R>,
}
impl<E, R> Default for ServiceErrorBuilder<E, R> {
fn default() -> Self {
Self {
source: N... | rust | rust | macro-heavy | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/result.rs | Apache-2.0 | 859d18e93f161db478e19f9db7e21ba30092426e | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/859d18e93f161db478e19f9db7e21ba30092426e/sdk/aws-smithy-http/src/result.rs | 121 | 180 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/result.rs:5 | self
}
/// Sets the raw response.
pub fn set_raw(&mut self, raw: Option<R>) -> &mut Self {
self.raw = raw;
self
}
/// Builds the error context.
pub fn build(self) -> ServiceError<E, R> {
ServiceError {
source: self.sou... | rust | rust | macro-heavy | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/result.rs | Apache-2.0 | 859d18e93f161db478e19f9db7e21ba30092426e | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/859d18e93f161db478e19f9db7e21ba30092426e/sdk/aws-smithy-http/src/result.rs | 161 | 220 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/result.rs:6 | pub fn builder() -> builders::TimeoutErrorBuilder {
builders::TimeoutErrorBuilder::new()
}
}
/// Error context for [`SdkError::DispatchFailure`]
#[derive(Debug)]
pub struct DispatchFailure {
source: ConnectorError,
}
impl DispatchFailure {
/// Creates a builder for this error context type.
pub... | rust | rust | macro-heavy | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/result.rs | Apache-2.0 | 859d18e93f161db478e19f9db7e21ba30092426e | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/859d18e93f161db478e19f9db7e21ba30092426e/sdk/aws-smithy-http/src/result.rs | 201 | 260 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/result.rs:7 | }
}
/// Error context for [`SdkError::ResponseError`]
#[derive(Debug)]
pub struct ResponseError<R> {
/// Error encountered while parsing the response
source: BoxError,
/// Raw response that was available
raw: R,
}
impl<R> ResponseError<R> {
/// Creates a builder for this error context type.
pu... | rust | rust | macro-heavy | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/result.rs | Apache-2.0 | 859d18e93f161db478e19f9db7e21ba30092426e | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/859d18e93f161db478e19f9db7e21ba30092426e/sdk/aws-smithy-http/src/result.rs | 241 | 300 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/result.rs:8 | pub fn builder() -> builders::ServiceErrorBuilder<E, R> {
builders::ServiceErrorBuilder::new()
}
/// Returns the underlying error of type `E`
pub fn err(&self) -> &E {
&self.source
}
/// Converts this error context into the underlying error `E`
pub fn into_err(self) -> E {
... | rust | rust | macro-heavy | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/result.rs | Apache-2.0 | 859d18e93f161db478e19f9db7e21ba30092426e | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/859d18e93f161db478e19f9db7e21ba30092426e/sdk/aws-smithy-http/src/result.rs | 281 | 340 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/result.rs:9 | /// error reporter library that visits the error's cause/source chain, or call
/// [`Error::source`](std::error::Error::source) for more details about the underlying cause.
#[non_exhaustive]
#[derive(Debug)]
pub enum SdkError<E, R = operation::Response> {
/// The request failed during construction. It was not dispa... | rust | rust | macro-heavy | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/result.rs | Apache-2.0 | 859d18e93f161db478e19f9db7e21ba30092426e | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/859d18e93f161db478e19f9db7e21ba30092426e/sdk/aws-smithy-http/src/result.rs | 321 | 380 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/result.rs:10 | Self::DispatchFailure(DispatchFailure { source })
}
/// Construct a `SdkError` for a response error
pub fn response_error(source: impl Into<BoxError>, raw: R) -> Self {
Self::ResponseError(ResponseError {
source: source.into(),
raw,
})
}
/// Construct a `Sdk... | rust | rust | macro-heavy | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/result.rs | Apache-2.0 | 859d18e93f161db478e19f9db7e21ba30092426e | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/859d18e93f161db478e19f9db7e21ba30092426e/sdk/aws-smithy-http/src/result.rs | 361 | 420 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/result.rs:11 | /// GetObjectError::NoSuchKey(_) => {
/// // handle NoSuchKey
/// }
/// err @ _ => return Err(err),
/// }
/// # Ok(())
/// # }
/// ```
pub fn into_service_error(self) -> E
where
E: std::error::Error + Send + Sync + CreateUnhandledError + 'static,
R... | rust | rust | macro-heavy | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/result.rs | Apache-2.0 | 859d18e93f161db478e19f9db7e21ba30092426e | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/859d18e93f161db478e19f9db7e21ba30092426e/sdk/aws-smithy-http/src/result.rs | 401 | 460 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/result.rs:12 | Self::ServiceError(context) => SdkError::<E2, R>::ServiceError(ServiceError {
source: map(context.source),
raw: context.raw,
}),
Self::ConstructionFailure(context) => SdkError::<E2, R>::ConstructionFailure(context),
Self::DispatchFailure(context) => Sd... | rust | rust | macro-heavy | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/result.rs | Apache-2.0 | 859d18e93f161db478e19f9db7e21ba30092426e | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/859d18e93f161db478e19f9db7e21ba30092426e/sdk/aws-smithy-http/src/result.rs | 441 | 500 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/result.rs:13 | impl<E, R> ProvideErrorMetadata for SdkError<E, R>
where
E: ProvideErrorMetadata,
{
fn meta(&self) -> &aws_smithy_types::Error {
match self {
Self::ConstructionFailure(_) => &EMPTY_ERROR_METADATA,
Self::TimeoutError(_) => &EMPTY_ERROR_METADATA,
Self::DispatchFailure(_... | rust | rust | macro-heavy | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/result.rs | Apache-2.0 | 859d18e93f161db478e19f9db7e21ba30092426e | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/859d18e93f161db478e19f9db7e21ba30092426e/sdk/aws-smithy-http/src/result.rs | 481 | 540 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/result.rs:14 | source: BoxError,
connection: ConnectionStatus,
}
#[non_exhaustive]
#[derive(Debug)]
pub(crate) enum ConnectionStatus {
/// This request was never connected to the remote
///
/// This indicates the failure was during connection establishment
NeverConnected,
/// It is unknown whether a connecti... | rust | rust | macro-heavy | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/result.rs | Apache-2.0 | 859d18e93f161db478e19f9db7e21ba30092426e | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/859d18e93f161db478e19f9db7e21ba30092426e/sdk/aws-smithy-http/src/result.rs | 521 | 580 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/result.rs:15 | pub fn timeout(source: BoxError) -> Self {
Self {
kind: ConnectorErrorKind::Timeout,
source,
connection: ConnectionStatus::Unknown,
}
}
/// Include connection information along with this error
pub fn with_connection(mut self, info: ConnectionMetadata) -> ... | rust | rust | macro-heavy | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/result.rs | Apache-2.0 | 859d18e93f161db478e19f9db7e21ba30092426e | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/859d18e93f161db478e19f9db7e21ba30092426e/sdk/aws-smithy-http/src/result.rs | 561 | 620 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/result.rs:16 | /// Optionally, an explicit `Kind` may be passed.
pub fn other(source: BoxError, kind: Option<ErrorKind>) -> Self {
Self {
source,
kind: ConnectorErrorKind::Other(kind),
connection: ConnectionStatus::Unknown,
}
}
/// Returns true if the error is an IO err... | rust | rust | macro-heavy | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/result.rs | Apache-2.0 | 859d18e93f161db478e19f9db7e21ba30092426e | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/859d18e93f161db478e19f9db7e21ba30092426e/sdk/aws-smithy-http/src/result.rs | 601 | 644 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/result.rs:11 | /// GetObjectError::NoSuchKey(_) => {
/// // handle NoSuchKey
/// }
/// err @ _ => return Err(err),
/// }
/// # Ok(())
/// # }
/// ```
pub fn into_service_error(self) -> E
where
E: std::error::Error + Send + Sync + CreateUnhandledError + 'static,
R... | rust | rust | macro-heavy | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/result.rs | Apache-2.0 | 240573efb2a1fa3bd2ec5d5eabedd37ee0de4ae9 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/240573efb2a1fa3bd2ec5d5eabedd37ee0de4ae9/sdk/aws-smithy-http/src/result.rs | 401 | 460 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/result.rs:12 | SdkError::ConstructionFailure(_) => write!(f, "failed to construct request"),
SdkError::TimeoutError(_) => write!(f, "request has timed out"),
SdkError::DispatchFailure(_) => write!(f, "dispatch failure"),
SdkError::ResponseError(_) => write!(f, "response error"),
SdkErro... | rust | rust | macro-heavy | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/result.rs | Apache-2.0 | 240573efb2a1fa3bd2ec5d5eabedd37ee0de4ae9 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/240573efb2a1fa3bd2ec5d5eabedd37ee0de4ae9/sdk/aws-smithy-http/src/result.rs | 441 | 500 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/result.rs:13 | #[derive(Debug)]
enum ConnectorErrorKind {
/// A timeout occurred while processing the request
Timeout,
/// A user-caused error (e.g., invalid HTTP request)
User,
/// Socket/IO error
Io,
/// An unclassified Error with an explicit error kind
Other(Option<ErrorKind>),
}
/// Error from ... | rust | rust | macro-heavy | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/result.rs | Apache-2.0 | 240573efb2a1fa3bd2ec5d5eabedd37ee0de4ae9 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/240573efb2a1fa3bd2ec5d5eabedd37ee0de4ae9/sdk/aws-smithy-http/src/result.rs | 481 | 540 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/result.rs:14 | /// The request connected to the remote prior to failure
Connected(ConnectionMetadata),
}
impl Display for ConnectorError {
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
match self.kind {
ConnectorErrorKind::Timeout => write!(f, "timeout"),
ConnectorErrorKind::User => wr... | rust | rust | macro-heavy | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/result.rs | Apache-2.0 | 240573efb2a1fa3bd2ec5d5eabedd37ee0de4ae9 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/240573efb2a1fa3bd2ec5d5eabedd37ee0de4ae9/sdk/aws-smithy-http/src/result.rs | 521 | 580 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/result.rs:15 | pub fn never_connected(mut self) -> Self {
self.connection = ConnectionStatus::NeverConnected;
self
}
/// Construct a [`ConnectorError`] from an error caused by the user (e.g. invalid HTTP request)
pub fn user(source: BoxError) -> Self {
Self {
kind: ConnectorErrorKind::... | rust | rust | macro-heavy | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/result.rs | Apache-2.0 | 240573efb2a1fa3bd2ec5d5eabedd37ee0de4ae9 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/240573efb2a1fa3bd2ec5d5eabedd37ee0de4ae9/sdk/aws-smithy-http/src/result.rs | 561 | 620 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/result.rs:16 | pub fn is_timeout(&self) -> bool {
matches!(self.kind, ConnectorErrorKind::Timeout)
}
/// Returns true if the error is a user-caused error (e.g., invalid HTTP request)
pub fn is_user(&self) -> bool {
matches!(self.kind, ConnectorErrorKind::User)
}
/// Returns the optional error kin... | rust | rust | macro-heavy | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/result.rs | Apache-2.0 | 240573efb2a1fa3bd2ec5d5eabedd37ee0de4ae9 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/240573efb2a1fa3bd2ec5d5eabedd37ee0de4ae9/sdk/aws-smithy-http/src/result.rs | 601 | 629 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/result.rs:8 | pub fn builder() -> builders::ServiceErrorBuilder<E, R> {
builders::ServiceErrorBuilder::new()
}
/// Returns the underlying error of type `E`
pub fn err(&self) -> &E {
&self.source
}
/// Converts this error context into the underlying error `E`
pub fn into_err(self) -> E {
... | rust | rust | macro-heavy | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/result.rs | Apache-2.0 | 2b4a7b881b8735aad288284e1c140ed40f474d06 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/2b4a7b881b8735aad288284e1c140ed40f474d06/sdk/aws-smithy-http/src/result.rs | 281 | 340 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/result.rs:9 | /// error reporter library that visits the error's cause/source chain, or call
/// [`Error::source`](std::error::Error::source) for more details about the underlying cause.
#[non_exhaustive]
#[derive(Debug)]
pub enum SdkError<E, R = operation::Response> {
/// The request failed during construction. It was not dispa... | rust | rust | macro-heavy | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/result.rs | Apache-2.0 | 2b4a7b881b8735aad288284e1c140ed40f474d06 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/2b4a7b881b8735aad288284e1c140ed40f474d06/sdk/aws-smithy-http/src/result.rs | 321 | 380 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/result.rs:1 | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/
#![warn(
missing_debug_implementations,
missing_docs,
rustdoc::all,
unreachable_pub
)]
//! `Result` wrapper types for [success](SdkSuccess) and [failure](SdkError) responses.
use crate:... | rust | rust | macro-heavy | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/result.rs | Apache-2.0 | 8657f207e05add10eb5b9d0faaa17522e42a3f84 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/8657f207e05add10eb5b9d0faaa17522e42a3f84/sdk/aws-smithy-http/src/result.rs | 1 | 60 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/result.rs:2 | ($errorName:ident, $builderName:ident, $sourceType:ident) => {
#[doc = concat!("Builder for [`", stringify!($errorName), "`](super::", stringify!($errorName), ").")]
#[derive(Debug, Default)]
pub struct $builderName {
source: Option<$sourceType>,
}
... | rust | rust | macro-heavy | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/result.rs | Apache-2.0 | 8657f207e05add10eb5b9d0faaa17522e42a3f84 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/8657f207e05add10eb5b9d0faaa17522e42a3f84/sdk/aws-smithy-http/src/result.rs | 41 | 100 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/result.rs:3 | }
impl<R> Default for ResponseErrorBuilder<R> {
fn default() -> Self {
Self {
source: None,
raw: None,
}
}
}
impl<R> ResponseErrorBuilder<R> {
/// Creates a new builder.
pub fn new() -> Self {
Default::defa... | rust | rust | macro-heavy | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/result.rs | Apache-2.0 | 8657f207e05add10eb5b9d0faaa17522e42a3f84 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/8657f207e05add10eb5b9d0faaa17522e42a3f84/sdk/aws-smithy-http/src/result.rs | 81 | 140 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/result.rs:4 | /// Builds the error context.
pub fn build(self) -> ResponseError<R> {
ResponseError {
source: self.source.expect("source is required"),
raw: self.raw.expect("a raw response is required"),
}
}
}
/// Builder for [`ServiceError`](super::Serv... | rust | rust | macro-heavy | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/result.rs | Apache-2.0 | 8657f207e05add10eb5b9d0faaa17522e42a3f84 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/8657f207e05add10eb5b9d0faaa17522e42a3f84/sdk/aws-smithy-http/src/result.rs | 121 | 180 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/result.rs:5 | self.source = source;
self
}
/// Sets the raw response.
pub fn raw(mut self, raw: R) -> Self {
self.raw = Some(raw);
self
}
/// Sets the raw response.
pub fn set_raw(&mut self, raw: Option<R>) -> &mut Self {
self.raw = raw... | rust | rust | macro-heavy | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/result.rs | Apache-2.0 | 8657f207e05add10eb5b9d0faaa17522e42a3f84 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/8657f207e05add10eb5b9d0faaa17522e42a3f84/sdk/aws-smithy-http/src/result.rs | 161 | 220 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/result.rs:6 | #[derive(Debug)]
pub struct TimeoutError {
source: BoxError,
}
impl TimeoutError {
/// Creates a builder for this error context type.
pub fn builder() -> builders::TimeoutErrorBuilder {
builders::TimeoutErrorBuilder::new()
}
}
/// Error context for [`SdkError::DispatchFailure`]
#[derive(Debug)... | rust | rust | macro-heavy | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/result.rs | Apache-2.0 | 8657f207e05add10eb5b9d0faaa17522e42a3f84 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/8657f207e05add10eb5b9d0faaa17522e42a3f84/sdk/aws-smithy-http/src/result.rs | 201 | 260 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/result.rs:7 | pub fn is_other(&self) -> Option<ErrorKind> {
self.source.is_other()
}
/// Returns the inner error if it is a connector error
pub fn as_connector_error(&self) -> Option<&ConnectorError> {
Some(&self.source)
}
}
/// Error context for [`SdkError::ResponseError`]
#[derive(Debug)]
pub stru... | rust | rust | macro-heavy | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/result.rs | Apache-2.0 | 8657f207e05add10eb5b9d0faaa17522e42a3f84 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/8657f207e05add10eb5b9d0faaa17522e42a3f84/sdk/aws-smithy-http/src/result.rs | 241 | 300 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/result.rs:9 | ) -> Self;
}
/// Failed SDK Result
///
/// When logging an error from the SDK, it is recommended that you either wrap the error in
/// [`DisplayErrorContext`](aws_smithy_types::error::display::DisplayErrorContext), use another
/// error reporter library that visits the error's cause/source chain, or call
/// [`Error::... | rust | rust | macro-heavy | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/result.rs | Apache-2.0 | 8657f207e05add10eb5b9d0faaa17522e42a3f84 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/8657f207e05add10eb5b9d0faaa17522e42a3f84/sdk/aws-smithy-http/src/result.rs | 321 | 380 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/result.rs:11 | /// # _: Box<dyn std::error::Error + Send + Sync + 'static>,
/// # _: Option<aws_smithy_types::error::ErrorMetadata>,
/// # ) -> Self { unimplemented!() }
/// # }
/// # fn example() -> Result<(), GetObjectError> {
/// # let sdk_err = SdkError::service_error(GetObjectError::NoSuch... | rust | rust | macro-heavy | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/result.rs | Apache-2.0 | 8657f207e05add10eb5b9d0faaa17522e42a3f84 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/8657f207e05add10eb5b9d0faaa17522e42a3f84/sdk/aws-smithy-http/src/result.rs | 401 | 460 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/result.rs:12 | }
}
}
impl<E, R> Display for SdkError<E, R> {
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
match self {
SdkError::ConstructionFailure(_) => write!(f, "failed to construct request"),
SdkError::TimeoutError(_) => write!(f, "request has timed out"),
SdkError::D... | rust | rust | macro-heavy | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/result.rs | Apache-2.0 | 8657f207e05add10eb5b9d0faaa17522e42a3f84 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/8657f207e05add10eb5b9d0faaa17522e42a3f84/sdk/aws-smithy-http/src/result.rs | 441 | 500 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/result.rs:13 | Self::TimeoutError(_) => &EMPTY_ERROR_METADATA,
Self::DispatchFailure(_) => &EMPTY_ERROR_METADATA,
Self::ResponseError(_) => &EMPTY_ERROR_METADATA,
Self::ServiceError(err) => err.source.meta(),
}
}
}
#[derive(Debug)]
enum ConnectorErrorKind {
/// A timeout occurred w... | rust | rust | macro-heavy | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/result.rs | Apache-2.0 | 8657f207e05add10eb5b9d0faaa17522e42a3f84 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/8657f207e05add10eb5b9d0faaa17522e42a3f84/sdk/aws-smithy-http/src/result.rs | 481 | 540 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/result.rs:14 | ///
/// This indicates the failure was during connection establishment
NeverConnected,
/// It is unknown whether a connection was established
Unknown,
/// The request connected to the remote prior to failure
Connected(ConnectionMetadata),
}
impl Display for ConnectorError {
fn fmt(&self, ... | rust | rust | macro-heavy | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/result.rs | Apache-2.0 | 8657f207e05add10eb5b9d0faaa17522e42a3f84 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/8657f207e05add10eb5b9d0faaa17522e42a3f84/sdk/aws-smithy-http/src/result.rs | 521 | 580 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/result.rs:15 | /// Include connection information along with this error
pub fn with_connection(mut self, info: ConnectionMetadata) -> Self {
self.connection = ConnectionStatus::Connected(info);
self
}
/// Set the connection status on this error to report that a connection was never established
pub fn ... | rust | rust | macro-heavy | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/result.rs | Apache-2.0 | 8657f207e05add10eb5b9d0faaa17522e42a3f84 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/8657f207e05add10eb5b9d0faaa17522e42a3f84/sdk/aws-smithy-http/src/result.rs | 561 | 620 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.