Struct aws_sdk_cloudfront::error::PublishFunctionError
source · #[non_exhaustive]pub struct PublishFunctionError {
pub kind: PublishFunctionErrorKind,
/* private fields */
}
Expand description
Error type for the PublishFunction
operation.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. }
syntax; cannot be matched against without a wildcard ..
; and struct update syntax will not work.kind: PublishFunctionErrorKind
Kind of error that occurred.
Implementations§
source§impl PublishFunctionError
impl PublishFunctionError
sourcepub fn new(kind: PublishFunctionErrorKind, meta: Error) -> Self
pub fn new(kind: PublishFunctionErrorKind, meta: Error) -> Self
Creates a new PublishFunctionError
.
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 PublishFunctionError::Unhandled
variant from any error type.
Examples found in repository?
10064 10065 10066 10067 10068 10069 10070 10071 10072 10073 10074 10075 10076 10077 10078 10079 10080 10081 10082 10083 10084 10085 10086 10087 10088 10089 10090 10091 10092 10093 10094 10095 10096 10097 10098 10099 10100 10101 10102 10103 10104 10105 10106 10107 10108 10109 10110 10111 10112 10113 10114 10115 10116 10117 10118 10119 10120 10121 10122 10123 10124 10125 10126 10127 10128 10129 10130 10131 10132 10133 10134 10135 10136 10137 10138 10139 10140 10141 10142 10143 10144 10145 10146 10147 10148 10149 10150 10151 10152 10153 10154 10155 10156 10157 10158 10159 10160 10161 10162 10163 10164 10165 10166 10167 10168 10169 10170
pub fn parse_publish_function_error(
response: &http::Response<bytes::Bytes>,
) -> std::result::Result<crate::output::PublishFunctionOutput, crate::error::PublishFunctionError> {
let generic = crate::xml_deser::parse_http_generic_error(response)
.map_err(crate::error::PublishFunctionError::unhandled)?;
let error_code = match generic.code() {
Some(code) => code,
None => return Err(crate::error::PublishFunctionError::unhandled(generic)),
};
let _error_message = generic.message().map(|msg| msg.to_owned());
Err(match error_code {
"InvalidArgument" => crate::error::PublishFunctionError {
meta: generic,
kind: crate::error::PublishFunctionErrorKind::InvalidArgument({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::invalid_argument::Builder::default();
let _ = response;
output =
crate::xml_deser::deser_structure_crate_error_invalid_argument_xml_err(
response.body().as_ref(),
output,
)
.map_err(crate::error::PublishFunctionError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"InvalidIfMatchVersion" => crate::error::PublishFunctionError {
meta: generic,
kind: crate::error::PublishFunctionErrorKind::InvalidIfMatchVersion({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::invalid_if_match_version::Builder::default();
let _ = response;
output = crate::xml_deser::deser_structure_crate_error_invalid_if_match_version_xml_err(response.body().as_ref(), output).map_err(crate::error::PublishFunctionError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"NoSuchFunctionExists" => crate::error::PublishFunctionError {
meta: generic,
kind: crate::error::PublishFunctionErrorKind::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::PublishFunctionError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"PreconditionFailed" => {
crate::error::PublishFunctionError {
meta: generic,
kind: crate::error::PublishFunctionErrorKind::PreconditionFailed({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::precondition_failed::Builder::default();
let _ = response;
output = crate::xml_deser::deser_structure_crate_error_precondition_failed_xml_err(response.body().as_ref(), output).map_err(crate::error::PublishFunctionError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
}
}
"UnsupportedOperation" => crate::error::PublishFunctionError {
meta: generic,
kind: crate::error::PublishFunctionErrorKind::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::PublishFunctionError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
_ => crate::error::PublishFunctionError::generic(generic),
})
}
sourcepub fn generic(err: Error) -> Self
pub fn generic(err: Error) -> Self
Creates the PublishFunctionError::Unhandled
variant from a aws_smithy_types::Error
.
Examples found in repository?
10064 10065 10066 10067 10068 10069 10070 10071 10072 10073 10074 10075 10076 10077 10078 10079 10080 10081 10082 10083 10084 10085 10086 10087 10088 10089 10090 10091 10092 10093 10094 10095 10096 10097 10098 10099 10100 10101 10102 10103 10104 10105 10106 10107 10108 10109 10110 10111 10112 10113 10114 10115 10116 10117 10118 10119 10120 10121 10122 10123 10124 10125 10126 10127 10128 10129 10130 10131 10132 10133 10134 10135 10136 10137 10138 10139 10140 10141 10142 10143 10144 10145 10146 10147 10148 10149 10150 10151 10152 10153 10154 10155 10156 10157 10158 10159 10160 10161 10162 10163 10164 10165 10166 10167 10168 10169 10170
pub fn parse_publish_function_error(
response: &http::Response<bytes::Bytes>,
) -> std::result::Result<crate::output::PublishFunctionOutput, crate::error::PublishFunctionError> {
let generic = crate::xml_deser::parse_http_generic_error(response)
.map_err(crate::error::PublishFunctionError::unhandled)?;
let error_code = match generic.code() {
Some(code) => code,
None => return Err(crate::error::PublishFunctionError::unhandled(generic)),
};
let _error_message = generic.message().map(|msg| msg.to_owned());
Err(match error_code {
"InvalidArgument" => crate::error::PublishFunctionError {
meta: generic,
kind: crate::error::PublishFunctionErrorKind::InvalidArgument({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::invalid_argument::Builder::default();
let _ = response;
output =
crate::xml_deser::deser_structure_crate_error_invalid_argument_xml_err(
response.body().as_ref(),
output,
)
.map_err(crate::error::PublishFunctionError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"InvalidIfMatchVersion" => crate::error::PublishFunctionError {
meta: generic,
kind: crate::error::PublishFunctionErrorKind::InvalidIfMatchVersion({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::invalid_if_match_version::Builder::default();
let _ = response;
output = crate::xml_deser::deser_structure_crate_error_invalid_if_match_version_xml_err(response.body().as_ref(), output).map_err(crate::error::PublishFunctionError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"NoSuchFunctionExists" => crate::error::PublishFunctionError {
meta: generic,
kind: crate::error::PublishFunctionErrorKind::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::PublishFunctionError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"PreconditionFailed" => {
crate::error::PublishFunctionError {
meta: generic,
kind: crate::error::PublishFunctionErrorKind::PreconditionFailed({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::precondition_failed::Builder::default();
let _ = response;
output = crate::xml_deser::deser_structure_crate_error_precondition_failed_xml_err(response.body().as_ref(), output).map_err(crate::error::PublishFunctionError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
}
}
"UnsupportedOperation" => crate::error::PublishFunctionError {
meta: generic,
kind: crate::error::PublishFunctionErrorKind::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::PublishFunctionError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
_ => crate::error::PublishFunctionError::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_invalid_argument(&self) -> bool
pub fn is_invalid_argument(&self) -> bool
Returns true
if the error kind is PublishFunctionErrorKind::InvalidArgument
.
sourcepub fn is_invalid_if_match_version(&self) -> bool
pub fn is_invalid_if_match_version(&self) -> bool
Returns true
if the error kind is PublishFunctionErrorKind::InvalidIfMatchVersion
.
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 PublishFunctionErrorKind::NoSuchFunctionExists
.
sourcepub fn is_precondition_failed(&self) -> bool
pub fn is_precondition_failed(&self) -> bool
Returns true
if the error kind is PublishFunctionErrorKind::PreconditionFailed
.
sourcepub fn is_unsupported_operation(&self) -> bool
pub fn is_unsupported_operation(&self) -> bool
Returns true
if the error kind is PublishFunctionErrorKind::UnsupportedOperation
.