Struct aws_sdk_cloudwatch::error::PutMetricStreamError
source · #[non_exhaustive]pub struct PutMetricStreamError {
pub kind: PutMetricStreamErrorKind,
/* private fields */
}Expand description
Error type for the PutMetricStream 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: PutMetricStreamErrorKindKind of error that occurred.
Implementations§
source§impl PutMetricStreamError
impl PutMetricStreamError
sourcepub fn new(kind: PutMetricStreamErrorKind, meta: Error) -> Self
pub fn new(kind: PutMetricStreamErrorKind, meta: Error) -> Self
Creates a new PutMetricStreamError.
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 PutMetricStreamError::Unhandled variant from any error type.
Examples found in repository?
2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549
pub fn parse_put_metric_stream_error(
response: &http::Response<bytes::Bytes>,
) -> std::result::Result<crate::output::PutMetricStreamOutput, crate::error::PutMetricStreamError> {
let generic = crate::xml_deser::parse_http_generic_error(response)
.map_err(crate::error::PutMetricStreamError::unhandled)?;
let error_code = match generic.code() {
Some(code) => code,
None => return Err(crate::error::PutMetricStreamError::unhandled(generic)),
};
let _error_message = generic.message().map(|msg| msg.to_owned());
Err(match error_code {
"ConcurrentModificationException" => crate::error::PutMetricStreamError {
meta: generic,
kind: crate::error::PutMetricStreamErrorKind::ConcurrentModificationException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output =
crate::error::concurrent_modification_exception::Builder::default();
let _ = response;
output = crate::xml_deser::deser_structure_crate_error_concurrent_modification_exception_xml_err(response.body().as_ref(), output).map_err(crate::error::PutMetricStreamError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"InternalServiceError" => crate::error::PutMetricStreamError {
meta: generic,
kind: crate::error::PutMetricStreamErrorKind::InternalServiceFault({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::internal_service_fault::Builder::default();
let _ = response;
output = crate::xml_deser::deser_structure_crate_error_internal_service_fault_xml_err(response.body().as_ref(), output).map_err(crate::error::PutMetricStreamError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"InvalidParameterCombination" => crate::error::PutMetricStreamError {
meta: generic,
kind: crate::error::PutMetricStreamErrorKind::InvalidParameterCombinationException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output =
crate::error::invalid_parameter_combination_exception::Builder::default();
let _ = response;
output = crate::xml_deser::deser_structure_crate_error_invalid_parameter_combination_exception_xml_err(response.body().as_ref(), output).map_err(crate::error::PutMetricStreamError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"InvalidParameterValue" => crate::error::PutMetricStreamError {
meta: generic,
kind: crate::error::PutMetricStreamErrorKind::InvalidParameterValueException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output =
crate::error::invalid_parameter_value_exception::Builder::default();
let _ = response;
output = crate::xml_deser::deser_structure_crate_error_invalid_parameter_value_exception_xml_err(response.body().as_ref(), output).map_err(crate::error::PutMetricStreamError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"MissingParameter" => crate::error::PutMetricStreamError {
meta: generic,
kind: crate::error::PutMetricStreamErrorKind::MissingRequiredParameterException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output =
crate::error::missing_required_parameter_exception::Builder::default();
let _ = response;
output = crate::xml_deser::deser_structure_crate_error_missing_required_parameter_exception_xml_err(response.body().as_ref(), output).map_err(crate::error::PutMetricStreamError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
_ => crate::error::PutMetricStreamError::generic(generic),
})
}sourcepub fn generic(err: Error) -> Self
pub fn generic(err: Error) -> Self
Creates the PutMetricStreamError::Unhandled variant from a aws_smithy_types::Error.
Examples found in repository?
2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549
pub fn parse_put_metric_stream_error(
response: &http::Response<bytes::Bytes>,
) -> std::result::Result<crate::output::PutMetricStreamOutput, crate::error::PutMetricStreamError> {
let generic = crate::xml_deser::parse_http_generic_error(response)
.map_err(crate::error::PutMetricStreamError::unhandled)?;
let error_code = match generic.code() {
Some(code) => code,
None => return Err(crate::error::PutMetricStreamError::unhandled(generic)),
};
let _error_message = generic.message().map(|msg| msg.to_owned());
Err(match error_code {
"ConcurrentModificationException" => crate::error::PutMetricStreamError {
meta: generic,
kind: crate::error::PutMetricStreamErrorKind::ConcurrentModificationException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output =
crate::error::concurrent_modification_exception::Builder::default();
let _ = response;
output = crate::xml_deser::deser_structure_crate_error_concurrent_modification_exception_xml_err(response.body().as_ref(), output).map_err(crate::error::PutMetricStreamError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"InternalServiceError" => crate::error::PutMetricStreamError {
meta: generic,
kind: crate::error::PutMetricStreamErrorKind::InternalServiceFault({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::internal_service_fault::Builder::default();
let _ = response;
output = crate::xml_deser::deser_structure_crate_error_internal_service_fault_xml_err(response.body().as_ref(), output).map_err(crate::error::PutMetricStreamError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"InvalidParameterCombination" => crate::error::PutMetricStreamError {
meta: generic,
kind: crate::error::PutMetricStreamErrorKind::InvalidParameterCombinationException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output =
crate::error::invalid_parameter_combination_exception::Builder::default();
let _ = response;
output = crate::xml_deser::deser_structure_crate_error_invalid_parameter_combination_exception_xml_err(response.body().as_ref(), output).map_err(crate::error::PutMetricStreamError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"InvalidParameterValue" => crate::error::PutMetricStreamError {
meta: generic,
kind: crate::error::PutMetricStreamErrorKind::InvalidParameterValueException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output =
crate::error::invalid_parameter_value_exception::Builder::default();
let _ = response;
output = crate::xml_deser::deser_structure_crate_error_invalid_parameter_value_exception_xml_err(response.body().as_ref(), output).map_err(crate::error::PutMetricStreamError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"MissingParameter" => crate::error::PutMetricStreamError {
meta: generic,
kind: crate::error::PutMetricStreamErrorKind::MissingRequiredParameterException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output =
crate::error::missing_required_parameter_exception::Builder::default();
let _ = response;
output = crate::xml_deser::deser_structure_crate_error_missing_required_parameter_exception_xml_err(response.body().as_ref(), output).map_err(crate::error::PutMetricStreamError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
_ => crate::error::PutMetricStreamError::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_concurrent_modification_exception(&self) -> bool
pub fn is_concurrent_modification_exception(&self) -> bool
Returns true if the error kind is PutMetricStreamErrorKind::ConcurrentModificationException.
sourcepub fn is_internal_service_fault(&self) -> bool
pub fn is_internal_service_fault(&self) -> bool
Returns true if the error kind is PutMetricStreamErrorKind::InternalServiceFault.
sourcepub fn is_invalid_parameter_combination_exception(&self) -> bool
pub fn is_invalid_parameter_combination_exception(&self) -> bool
Returns true if the error kind is PutMetricStreamErrorKind::InvalidParameterCombinationException.
sourcepub fn is_invalid_parameter_value_exception(&self) -> bool
pub fn is_invalid_parameter_value_exception(&self) -> bool
Returns true if the error kind is PutMetricStreamErrorKind::InvalidParameterValueException.
sourcepub fn is_missing_required_parameter_exception(&self) -> bool
pub fn is_missing_required_parameter_exception(&self) -> bool
Returns true if the error kind is PutMetricStreamErrorKind::MissingRequiredParameterException.