Struct aws_sdk_cloudfront::error::UpdateFunctionError
source · #[non_exhaustive]pub struct UpdateFunctionError {
pub kind: UpdateFunctionErrorKind,
/* private fields */
}
Expand description
Error type for the UpdateFunction
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: UpdateFunctionErrorKind
Kind of error that occurred.
Implementations§
source§impl UpdateFunctionError
impl UpdateFunctionError
sourcepub fn new(kind: UpdateFunctionErrorKind, meta: Error) -> Self
pub fn new(kind: UpdateFunctionErrorKind, meta: Error) -> Self
Creates a new UpdateFunctionError
.
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 UpdateFunctionError::Unhandled
variant from any error type.
Examples found in repository?
12280 12281 12282 12283 12284 12285 12286 12287 12288 12289 12290 12291 12292 12293 12294 12295 12296 12297 12298 12299 12300 12301 12302 12303 12304 12305 12306 12307 12308 12309 12310 12311 12312 12313 12314 12315 12316 12317 12318 12319 12320 12321 12322 12323 12324 12325 12326 12327 12328 12329 12330 12331 12332 12333 12334 12335 12336 12337 12338 12339 12340 12341 12342 12343 12344 12345 12346 12347 12348 12349 12350 12351 12352 12353 12354 12355 12356 12357 12358 12359 12360 12361 12362 12363 12364 12365 12366 12367 12368 12369 12370 12371 12372 12373 12374 12375 12376 12377 12378 12379 12380 12381 12382 12383 12384 12385 12386 12387 12388 12389 12390 12391 12392 12393 12394 12395 12396 12397 12398 12399 12400 12401 12402 12403 12404 12405 12406 12407 12408 12409 12410 12411 12412 12413 12414 12415 12416 12417 12418 12419 12420 12421 12422 12423 12424 12425 12426 12427 12428
pub fn parse_update_function_error(
response: &http::Response<bytes::Bytes>,
) -> std::result::Result<crate::output::UpdateFunctionOutput, crate::error::UpdateFunctionError> {
let generic = crate::xml_deser::parse_http_generic_error(response)
.map_err(crate::error::UpdateFunctionError::unhandled)?;
let error_code = match generic.code() {
Some(code) => code,
None => return Err(crate::error::UpdateFunctionError::unhandled(generic)),
};
let _error_message = generic.message().map(|msg| msg.to_owned());
Err(match error_code {
"FunctionSizeLimitExceeded" => crate::error::UpdateFunctionError {
meta: generic,
kind: crate::error::UpdateFunctionErrorKind::FunctionSizeLimitExceeded({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::function_size_limit_exceeded::Builder::default();
let _ = response;
output = crate::xml_deser::deser_structure_crate_error_function_size_limit_exceeded_xml_err(response.body().as_ref(), output).map_err(crate::error::UpdateFunctionError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"InvalidArgument" => crate::error::UpdateFunctionError {
meta: generic,
kind: crate::error::UpdateFunctionErrorKind::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::UpdateFunctionError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"InvalidIfMatchVersion" => crate::error::UpdateFunctionError {
meta: generic,
kind: crate::error::UpdateFunctionErrorKind::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::UpdateFunctionError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"NoSuchFunctionExists" => crate::error::UpdateFunctionError {
meta: generic,
kind: crate::error::UpdateFunctionErrorKind::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::UpdateFunctionError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"PreconditionFailed" => {
crate::error::UpdateFunctionError {
meta: generic,
kind: crate::error::UpdateFunctionErrorKind::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::UpdateFunctionError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
}
}
"UnsupportedOperation" => crate::error::UpdateFunctionError {
meta: generic,
kind: crate::error::UpdateFunctionErrorKind::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::UpdateFunctionError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
_ => crate::error::UpdateFunctionError::generic(generic),
})
}
#[allow(clippy::unnecessary_wraps)]
pub fn parse_update_function_response(
response: &http::Response<bytes::Bytes>,
) -> std::result::Result<crate::output::UpdateFunctionOutput, crate::error::UpdateFunctionError> {
Ok({
#[allow(unused_mut)]
let mut output = crate::output::update_function_output::Builder::default();
let _ = response;
output = output.set_e_tag(
crate::http_serde::deser_header_update_function_update_function_output_e_tag(
response.headers(),
)
.map_err(|_| {
crate::error::UpdateFunctionError::unhandled(
"Failed to parse ETag from header `ETtag",
)
})?,
);
output = output.set_function_summary(
crate::http_serde::deser_payload_update_function_update_function_output_function_summary(response.body().as_ref())?
);
output.build()
})
}
sourcepub fn generic(err: Error) -> Self
pub fn generic(err: Error) -> Self
Creates the UpdateFunctionError::Unhandled
variant from a aws_smithy_types::Error
.
Examples found in repository?
12280 12281 12282 12283 12284 12285 12286 12287 12288 12289 12290 12291 12292 12293 12294 12295 12296 12297 12298 12299 12300 12301 12302 12303 12304 12305 12306 12307 12308 12309 12310 12311 12312 12313 12314 12315 12316 12317 12318 12319 12320 12321 12322 12323 12324 12325 12326 12327 12328 12329 12330 12331 12332 12333 12334 12335 12336 12337 12338 12339 12340 12341 12342 12343 12344 12345 12346 12347 12348 12349 12350 12351 12352 12353 12354 12355 12356 12357 12358 12359 12360 12361 12362 12363 12364 12365 12366 12367 12368 12369 12370 12371 12372 12373 12374 12375 12376 12377 12378 12379 12380 12381 12382 12383 12384 12385 12386 12387 12388 12389 12390 12391 12392 12393 12394 12395 12396 12397 12398 12399 12400 12401 12402 12403
pub fn parse_update_function_error(
response: &http::Response<bytes::Bytes>,
) -> std::result::Result<crate::output::UpdateFunctionOutput, crate::error::UpdateFunctionError> {
let generic = crate::xml_deser::parse_http_generic_error(response)
.map_err(crate::error::UpdateFunctionError::unhandled)?;
let error_code = match generic.code() {
Some(code) => code,
None => return Err(crate::error::UpdateFunctionError::unhandled(generic)),
};
let _error_message = generic.message().map(|msg| msg.to_owned());
Err(match error_code {
"FunctionSizeLimitExceeded" => crate::error::UpdateFunctionError {
meta: generic,
kind: crate::error::UpdateFunctionErrorKind::FunctionSizeLimitExceeded({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::function_size_limit_exceeded::Builder::default();
let _ = response;
output = crate::xml_deser::deser_structure_crate_error_function_size_limit_exceeded_xml_err(response.body().as_ref(), output).map_err(crate::error::UpdateFunctionError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"InvalidArgument" => crate::error::UpdateFunctionError {
meta: generic,
kind: crate::error::UpdateFunctionErrorKind::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::UpdateFunctionError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"InvalidIfMatchVersion" => crate::error::UpdateFunctionError {
meta: generic,
kind: crate::error::UpdateFunctionErrorKind::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::UpdateFunctionError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"NoSuchFunctionExists" => crate::error::UpdateFunctionError {
meta: generic,
kind: crate::error::UpdateFunctionErrorKind::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::UpdateFunctionError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"PreconditionFailed" => {
crate::error::UpdateFunctionError {
meta: generic,
kind: crate::error::UpdateFunctionErrorKind::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::UpdateFunctionError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
}
}
"UnsupportedOperation" => crate::error::UpdateFunctionError {
meta: generic,
kind: crate::error::UpdateFunctionErrorKind::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::UpdateFunctionError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
_ => crate::error::UpdateFunctionError::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_function_size_limit_exceeded(&self) -> bool
pub fn is_function_size_limit_exceeded(&self) -> bool
Returns true
if the error kind is UpdateFunctionErrorKind::FunctionSizeLimitExceeded
.
sourcepub fn is_invalid_argument(&self) -> bool
pub fn is_invalid_argument(&self) -> bool
Returns true
if the error kind is UpdateFunctionErrorKind::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 UpdateFunctionErrorKind::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 UpdateFunctionErrorKind::NoSuchFunctionExists
.
sourcepub fn is_precondition_failed(&self) -> bool
pub fn is_precondition_failed(&self) -> bool
Returns true
if the error kind is UpdateFunctionErrorKind::PreconditionFailed
.
sourcepub fn is_unsupported_operation(&self) -> bool
pub fn is_unsupported_operation(&self) -> bool
Returns true
if the error kind is UpdateFunctionErrorKind::UnsupportedOperation
.