Struct aws_sdk_iot::error::GetStatisticsError
source · #[non_exhaustive]pub struct GetStatisticsError {
pub kind: GetStatisticsErrorKind,
/* private fields */
}
Expand description
Error type for the GetStatistics
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: GetStatisticsErrorKind
Kind of error that occurred.
Implementations§
source§impl GetStatisticsError
impl GetStatisticsError
sourcepub fn new(kind: GetStatisticsErrorKind, meta: Error) -> Self
pub fn new(kind: GetStatisticsErrorKind, meta: Error) -> Self
Creates a new GetStatisticsError
.
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 GetStatisticsError::Unhandled
variant from any error type.
Examples found in repository?
16459 16460 16461 16462 16463 16464 16465 16466 16467 16468 16469 16470 16471 16472 16473 16474 16475 16476 16477 16478 16479 16480 16481 16482 16483 16484 16485 16486 16487 16488 16489 16490 16491 16492 16493 16494 16495 16496 16497 16498 16499 16500 16501 16502 16503 16504 16505 16506 16507 16508 16509 16510 16511 16512 16513 16514 16515 16516 16517 16518 16519 16520 16521 16522 16523 16524 16525 16526 16527 16528 16529 16530 16531 16532 16533 16534 16535 16536 16537 16538 16539 16540 16541 16542 16543 16544 16545 16546 16547 16548 16549 16550 16551 16552 16553 16554 16555 16556 16557 16558 16559 16560 16561 16562 16563 16564 16565 16566 16567 16568 16569 16570 16571 16572 16573 16574 16575 16576 16577 16578 16579 16580 16581 16582 16583 16584 16585 16586 16587 16588 16589 16590 16591 16592 16593 16594 16595 16596 16597 16598 16599 16600 16601 16602 16603 16604 16605 16606 16607 16608 16609 16610 16611 16612 16613 16614 16615 16616 16617 16618 16619 16620 16621 16622 16623 16624 16625 16626 16627 16628
pub fn parse_get_statistics_error(
response: &http::Response<bytes::Bytes>,
) -> std::result::Result<crate::output::GetStatisticsOutput, crate::error::GetStatisticsError> {
let generic = crate::json_deser::parse_http_generic_error(response)
.map_err(crate::error::GetStatisticsError::unhandled)?;
let error_code = match generic.code() {
Some(code) => code,
None => return Err(crate::error::GetStatisticsError::unhandled(generic)),
};
let _error_message = generic.message().map(|msg| msg.to_owned());
Err(match error_code {
"IndexNotReadyException" => crate::error::GetStatisticsError {
meta: generic,
kind: crate::error::GetStatisticsErrorKind::IndexNotReadyException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::index_not_ready_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_index_not_ready_exception_json_err(response.body().as_ref(), output).map_err(crate::error::GetStatisticsError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"InternalFailureException" => crate::error::GetStatisticsError {
meta: generic,
kind: crate::error::GetStatisticsErrorKind::InternalFailureException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::internal_failure_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_internal_failure_exception_json_err(response.body().as_ref(), output).map_err(crate::error::GetStatisticsError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"InvalidAggregationException" => crate::error::GetStatisticsError {
meta: generic,
kind: crate::error::GetStatisticsErrorKind::InvalidAggregationException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output =
crate::error::invalid_aggregation_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_invalid_aggregation_exception_json_err(response.body().as_ref(), output).map_err(crate::error::GetStatisticsError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"InvalidQueryException" => crate::error::GetStatisticsError {
meta: generic,
kind: crate::error::GetStatisticsErrorKind::InvalidQueryException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::invalid_query_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_invalid_query_exception_json_err(response.body().as_ref(), output).map_err(crate::error::GetStatisticsError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"InvalidRequestException" => crate::error::GetStatisticsError {
meta: generic,
kind: crate::error::GetStatisticsErrorKind::InvalidRequestException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::invalid_request_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_invalid_request_exception_json_err(response.body().as_ref(), output).map_err(crate::error::GetStatisticsError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"ResourceNotFoundException" => crate::error::GetStatisticsError {
meta: generic,
kind: crate::error::GetStatisticsErrorKind::ResourceNotFoundException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::resource_not_found_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_resource_not_found_exception_json_err(response.body().as_ref(), output).map_err(crate::error::GetStatisticsError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"ServiceUnavailableException" => crate::error::GetStatisticsError {
meta: generic,
kind: crate::error::GetStatisticsErrorKind::ServiceUnavailableException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output =
crate::error::service_unavailable_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_service_unavailable_exception_json_err(response.body().as_ref(), output).map_err(crate::error::GetStatisticsError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"ThrottlingException" => crate::error::GetStatisticsError {
meta: generic,
kind: crate::error::GetStatisticsErrorKind::ThrottlingException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::throttling_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_throttling_exception_json_err(response.body().as_ref(), output).map_err(crate::error::GetStatisticsError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"UnauthorizedException" => crate::error::GetStatisticsError {
meta: generic,
kind: crate::error::GetStatisticsErrorKind::UnauthorizedException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::unauthorized_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_unauthorized_exception_json_err(response.body().as_ref(), output).map_err(crate::error::GetStatisticsError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
_ => crate::error::GetStatisticsError::generic(generic),
})
}
sourcepub fn generic(err: Error) -> Self
pub fn generic(err: Error) -> Self
Creates the GetStatisticsError::Unhandled
variant from a aws_smithy_types::Error
.
Examples found in repository?
16459 16460 16461 16462 16463 16464 16465 16466 16467 16468 16469 16470 16471 16472 16473 16474 16475 16476 16477 16478 16479 16480 16481 16482 16483 16484 16485 16486 16487 16488 16489 16490 16491 16492 16493 16494 16495 16496 16497 16498 16499 16500 16501 16502 16503 16504 16505 16506 16507 16508 16509 16510 16511 16512 16513 16514 16515 16516 16517 16518 16519 16520 16521 16522 16523 16524 16525 16526 16527 16528 16529 16530 16531 16532 16533 16534 16535 16536 16537 16538 16539 16540 16541 16542 16543 16544 16545 16546 16547 16548 16549 16550 16551 16552 16553 16554 16555 16556 16557 16558 16559 16560 16561 16562 16563 16564 16565 16566 16567 16568 16569 16570 16571 16572 16573 16574 16575 16576 16577 16578 16579 16580 16581 16582 16583 16584 16585 16586 16587 16588 16589 16590 16591 16592 16593 16594 16595 16596 16597 16598 16599 16600 16601 16602 16603 16604 16605 16606 16607 16608 16609 16610 16611 16612 16613 16614 16615 16616 16617 16618 16619 16620 16621 16622 16623 16624 16625 16626 16627 16628
pub fn parse_get_statistics_error(
response: &http::Response<bytes::Bytes>,
) -> std::result::Result<crate::output::GetStatisticsOutput, crate::error::GetStatisticsError> {
let generic = crate::json_deser::parse_http_generic_error(response)
.map_err(crate::error::GetStatisticsError::unhandled)?;
let error_code = match generic.code() {
Some(code) => code,
None => return Err(crate::error::GetStatisticsError::unhandled(generic)),
};
let _error_message = generic.message().map(|msg| msg.to_owned());
Err(match error_code {
"IndexNotReadyException" => crate::error::GetStatisticsError {
meta: generic,
kind: crate::error::GetStatisticsErrorKind::IndexNotReadyException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::index_not_ready_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_index_not_ready_exception_json_err(response.body().as_ref(), output).map_err(crate::error::GetStatisticsError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"InternalFailureException" => crate::error::GetStatisticsError {
meta: generic,
kind: crate::error::GetStatisticsErrorKind::InternalFailureException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::internal_failure_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_internal_failure_exception_json_err(response.body().as_ref(), output).map_err(crate::error::GetStatisticsError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"InvalidAggregationException" => crate::error::GetStatisticsError {
meta: generic,
kind: crate::error::GetStatisticsErrorKind::InvalidAggregationException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output =
crate::error::invalid_aggregation_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_invalid_aggregation_exception_json_err(response.body().as_ref(), output).map_err(crate::error::GetStatisticsError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"InvalidQueryException" => crate::error::GetStatisticsError {
meta: generic,
kind: crate::error::GetStatisticsErrorKind::InvalidQueryException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::invalid_query_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_invalid_query_exception_json_err(response.body().as_ref(), output).map_err(crate::error::GetStatisticsError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"InvalidRequestException" => crate::error::GetStatisticsError {
meta: generic,
kind: crate::error::GetStatisticsErrorKind::InvalidRequestException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::invalid_request_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_invalid_request_exception_json_err(response.body().as_ref(), output).map_err(crate::error::GetStatisticsError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"ResourceNotFoundException" => crate::error::GetStatisticsError {
meta: generic,
kind: crate::error::GetStatisticsErrorKind::ResourceNotFoundException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::resource_not_found_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_resource_not_found_exception_json_err(response.body().as_ref(), output).map_err(crate::error::GetStatisticsError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"ServiceUnavailableException" => crate::error::GetStatisticsError {
meta: generic,
kind: crate::error::GetStatisticsErrorKind::ServiceUnavailableException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output =
crate::error::service_unavailable_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_service_unavailable_exception_json_err(response.body().as_ref(), output).map_err(crate::error::GetStatisticsError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"ThrottlingException" => crate::error::GetStatisticsError {
meta: generic,
kind: crate::error::GetStatisticsErrorKind::ThrottlingException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::throttling_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_throttling_exception_json_err(response.body().as_ref(), output).map_err(crate::error::GetStatisticsError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"UnauthorizedException" => crate::error::GetStatisticsError {
meta: generic,
kind: crate::error::GetStatisticsErrorKind::UnauthorizedException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::unauthorized_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_unauthorized_exception_json_err(response.body().as_ref(), output).map_err(crate::error::GetStatisticsError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
_ => crate::error::GetStatisticsError::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_index_not_ready_exception(&self) -> bool
pub fn is_index_not_ready_exception(&self) -> bool
Returns true
if the error kind is GetStatisticsErrorKind::IndexNotReadyException
.
sourcepub fn is_internal_failure_exception(&self) -> bool
pub fn is_internal_failure_exception(&self) -> bool
Returns true
if the error kind is GetStatisticsErrorKind::InternalFailureException
.
sourcepub fn is_invalid_aggregation_exception(&self) -> bool
pub fn is_invalid_aggregation_exception(&self) -> bool
Returns true
if the error kind is GetStatisticsErrorKind::InvalidAggregationException
.
sourcepub fn is_invalid_query_exception(&self) -> bool
pub fn is_invalid_query_exception(&self) -> bool
Returns true
if the error kind is GetStatisticsErrorKind::InvalidQueryException
.
sourcepub fn is_invalid_request_exception(&self) -> bool
pub fn is_invalid_request_exception(&self) -> bool
Returns true
if the error kind is GetStatisticsErrorKind::InvalidRequestException
.
sourcepub fn is_resource_not_found_exception(&self) -> bool
pub fn is_resource_not_found_exception(&self) -> bool
Returns true
if the error kind is GetStatisticsErrorKind::ResourceNotFoundException
.
Returns true
if the error kind is GetStatisticsErrorKind::ServiceUnavailableException
.
sourcepub fn is_throttling_exception(&self) -> bool
pub fn is_throttling_exception(&self) -> bool
Returns true
if the error kind is GetStatisticsErrorKind::ThrottlingException
.
Returns true
if the error kind is GetStatisticsErrorKind::UnauthorizedException
.