Struct aws_sdk_cloudfront::error::GetFunctionError
source · #[non_exhaustive]pub struct GetFunctionError {
pub kind: GetFunctionErrorKind,
/* private fields */
}
Expand description
Error type for the GetFunction
operation.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. }
syntax; cannot be matched against without a wildcard ..
; and struct update syntax will not work.kind: GetFunctionErrorKind
Kind of error that occurred.
Implementations§
source§impl GetFunctionError
impl GetFunctionError
sourcepub fn new(kind: GetFunctionErrorKind, meta: Error) -> Self
pub fn new(kind: GetFunctionErrorKind, meta: Error) -> Self
Creates a new GetFunctionError
.
sourcepub fn unhandled(err: impl Into<Box<dyn Error + Send + Sync + 'static>>) -> Self
pub fn unhandled(err: impl Into<Box<dyn Error + Send + Sync + 'static>>) -> Self
Creates the GetFunctionError::Unhandled
variant from any error type.
Examples found in repository?
src/operation_deser.rs (line 6936)
6929 6930 6931 6932 6933 6934 6935 6936 6937 6938 6939 6940 6941 6942 6943 6944 6945 6946 6947 6948 6949 6950 6951 6952 6953 6954 6955 6956 6957 6958 6959 6960 6961 6962 6963 6964 6965 6966 6967 6968 6969 6970 6971 6972 6973 6974 6975 6976 6977 6978 6979 6980 6981 6982 6983 6984 6985 6986 6987 6988 6989 6990 6991 6992 6993 6994 6995 6996 6997 6998 6999 7000 7001 7002 7003 7004 7005 7006 7007 7008 7009 7010 7011 7012
pub fn parse_get_function_error(
response: &http::Response<bytes::Bytes>,
) -> std::result::Result<crate::output::GetFunctionOutput, crate::error::GetFunctionError> {
let generic = crate::xml_deser::parse_http_generic_error(response)
.map_err(crate::error::GetFunctionError::unhandled)?;
let error_code = match generic.code() {
Some(code) => code,
None => return Err(crate::error::GetFunctionError::unhandled(generic)),
};
let _error_message = generic.message().map(|msg| msg.to_owned());
Err(match error_code {
"NoSuchFunctionExists" => crate::error::GetFunctionError {
meta: generic,
kind: crate::error::GetFunctionErrorKind::NoSuchFunctionExists({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::no_such_function_exists::Builder::default();
let _ = response;
output = crate::xml_deser::deser_structure_crate_error_no_such_function_exists_xml_err(response.body().as_ref(), output).map_err(crate::error::GetFunctionError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"UnsupportedOperation" => crate::error::GetFunctionError {
meta: generic,
kind: crate::error::GetFunctionErrorKind::UnsupportedOperation({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::unsupported_operation::Builder::default();
let _ = response;
output = crate::xml_deser::deser_structure_crate_error_unsupported_operation_xml_err(response.body().as_ref(), output).map_err(crate::error::GetFunctionError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
_ => crate::error::GetFunctionError::generic(generic),
})
}
#[allow(clippy::unnecessary_wraps)]
pub fn parse_get_function_response(
response: &http::Response<bytes::Bytes>,
) -> std::result::Result<crate::output::GetFunctionOutput, crate::error::GetFunctionError> {
Ok({
#[allow(unused_mut)]
let mut output = crate::output::get_function_output::Builder::default();
let _ = response;
output = output.set_content_type(
crate::http_serde::deser_header_get_function_get_function_output_content_type(
response.headers(),
)
.map_err(|_| {
crate::error::GetFunctionError::unhandled(
"Failed to parse ContentType from header `Content-Type",
)
})?,
);
output = output.set_e_tag(
crate::http_serde::deser_header_get_function_get_function_output_e_tag(
response.headers(),
)
.map_err(|_| {
crate::error::GetFunctionError::unhandled("Failed to parse ETag from header `ETag")
})?,
);
output = output.set_function_code(
crate::http_serde::deser_payload_get_function_get_function_output_function_code(
response.body().as_ref(),
)?,
);
output.build()
})
}
sourcepub fn generic(err: Error) -> Self
pub fn generic(err: Error) -> Self
Creates the GetFunctionError::Unhandled
variant from a aws_smithy_types::Error
.
Examples found in repository?
src/operation_deser.rs (line 6975)
6929 6930 6931 6932 6933 6934 6935 6936 6937 6938 6939 6940 6941 6942 6943 6944 6945 6946 6947 6948 6949 6950 6951 6952 6953 6954 6955 6956 6957 6958 6959 6960 6961 6962 6963 6964 6965 6966 6967 6968 6969 6970 6971 6972 6973 6974 6975 6976 6977
pub fn parse_get_function_error(
response: &http::Response<bytes::Bytes>,
) -> std::result::Result<crate::output::GetFunctionOutput, crate::error::GetFunctionError> {
let generic = crate::xml_deser::parse_http_generic_error(response)
.map_err(crate::error::GetFunctionError::unhandled)?;
let error_code = match generic.code() {
Some(code) => code,
None => return Err(crate::error::GetFunctionError::unhandled(generic)),
};
let _error_message = generic.message().map(|msg| msg.to_owned());
Err(match error_code {
"NoSuchFunctionExists" => crate::error::GetFunctionError {
meta: generic,
kind: crate::error::GetFunctionErrorKind::NoSuchFunctionExists({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::no_such_function_exists::Builder::default();
let _ = response;
output = crate::xml_deser::deser_structure_crate_error_no_such_function_exists_xml_err(response.body().as_ref(), output).map_err(crate::error::GetFunctionError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"UnsupportedOperation" => crate::error::GetFunctionError {
meta: generic,
kind: crate::error::GetFunctionErrorKind::UnsupportedOperation({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::unsupported_operation::Builder::default();
let _ = response;
output = crate::xml_deser::deser_structure_crate_error_unsupported_operation_xml_err(response.body().as_ref(), output).map_err(crate::error::GetFunctionError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
_ => crate::error::GetFunctionError::generic(generic),
})
}
sourcepub fn meta(&self) -> &Error
pub fn meta(&self) -> &Error
Returns error metadata, which includes the error code, message, request ID, and potentially additional information.
sourcepub fn request_id(&self) -> Option<&str>
pub fn request_id(&self) -> Option<&str>
Returns the request ID if it’s available.
sourcepub fn is_no_such_function_exists(&self) -> bool
pub fn is_no_such_function_exists(&self) -> bool
Returns true
if the error kind is GetFunctionErrorKind::NoSuchFunctionExists
.
sourcepub fn is_unsupported_operation(&self) -> bool
pub fn is_unsupported_operation(&self) -> bool
Returns true
if the error kind is GetFunctionErrorKind::UnsupportedOperation
.
Trait Implementations§
source§impl Debug for GetFunctionError
impl Debug for GetFunctionError
source§impl Display for GetFunctionError
impl Display for GetFunctionError
source§impl Error for GetFunctionError
impl Error for GetFunctionError
source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
The lower-level source of this error, if any. Read more
1.0.0 · source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0: use the Display impl or to_string()
source§impl From<GetFunctionError> for Error
impl From<GetFunctionError> for Error
source§fn from(err: GetFunctionError) -> Self
fn from(err: GetFunctionError) -> Self
Converts to this type from the input type.