Struct aws_sdk_cloudfront::error::ListCachePoliciesError
source · #[non_exhaustive]pub struct ListCachePoliciesError {
pub kind: ListCachePoliciesErrorKind,
/* private fields */
}
Expand description
Error type for the ListCachePolicies
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: ListCachePoliciesErrorKind
Kind of error that occurred.
Implementations§
source§impl ListCachePoliciesError
impl ListCachePoliciesError
sourcepub fn new(kind: ListCachePoliciesErrorKind, meta: Error) -> Self
pub fn new(kind: ListCachePoliciesErrorKind, meta: Error) -> Self
Creates a new ListCachePoliciesError
.
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 ListCachePoliciesError::Unhandled
variant from any error type.
Examples found in repository?
src/operation_deser.rs (line 8307)
8299 8300 8301 8302 8303 8304 8305 8306 8307 8308 8309 8310 8311 8312 8313 8314 8315 8316 8317 8318 8319 8320 8321 8322 8323 8324 8325 8326 8327 8328 8329 8330 8331 8332 8333 8334 8335 8336 8337 8338 8339 8340 8341 8342 8343 8344 8345 8346 8347 8348 8349 8350 8351 8352 8353 8354 8355 8356 8357 8358 8359 8360 8361 8362 8363 8364 8365 8366 8367 8368 8369 8370 8371 8372 8373 8374 8375 8376
pub fn parse_list_cache_policies_error(
response: &http::Response<bytes::Bytes>,
) -> std::result::Result<crate::output::ListCachePoliciesOutput, crate::error::ListCachePoliciesError>
{
let generic = crate::xml_deser::parse_http_generic_error(response)
.map_err(crate::error::ListCachePoliciesError::unhandled)?;
let error_code = match generic.code() {
Some(code) => code,
None => return Err(crate::error::ListCachePoliciesError::unhandled(generic)),
};
let _error_message = generic.message().map(|msg| msg.to_owned());
Err(match error_code {
"AccessDenied" => crate::error::ListCachePoliciesError {
meta: generic,
kind: crate::error::ListCachePoliciesErrorKind::AccessDenied({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::access_denied::Builder::default();
let _ = response;
output = crate::xml_deser::deser_structure_crate_error_access_denied_xml_err(
response.body().as_ref(),
output,
)
.map_err(crate::error::ListCachePoliciesError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"InvalidArgument" => crate::error::ListCachePoliciesError {
meta: generic,
kind: crate::error::ListCachePoliciesErrorKind::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::ListCachePoliciesError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"NoSuchCachePolicy" => {
crate::error::ListCachePoliciesError {
meta: generic,
kind: crate::error::ListCachePoliciesErrorKind::NoSuchCachePolicy({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::no_such_cache_policy::Builder::default();
let _ = response;
output = crate::xml_deser::deser_structure_crate_error_no_such_cache_policy_xml_err(response.body().as_ref(), output).map_err(crate::error::ListCachePoliciesError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
}
}
_ => crate::error::ListCachePoliciesError::generic(generic),
})
}
sourcepub fn generic(err: Error) -> Self
pub fn generic(err: Error) -> Self
Creates the ListCachePoliciesError::Unhandled
variant from a aws_smithy_types::Error
.
Examples found in repository?
src/operation_deser.rs (line 8374)
8299 8300 8301 8302 8303 8304 8305 8306 8307 8308 8309 8310 8311 8312 8313 8314 8315 8316 8317 8318 8319 8320 8321 8322 8323 8324 8325 8326 8327 8328 8329 8330 8331 8332 8333 8334 8335 8336 8337 8338 8339 8340 8341 8342 8343 8344 8345 8346 8347 8348 8349 8350 8351 8352 8353 8354 8355 8356 8357 8358 8359 8360 8361 8362 8363 8364 8365 8366 8367 8368 8369 8370 8371 8372 8373 8374 8375 8376
pub fn parse_list_cache_policies_error(
response: &http::Response<bytes::Bytes>,
) -> std::result::Result<crate::output::ListCachePoliciesOutput, crate::error::ListCachePoliciesError>
{
let generic = crate::xml_deser::parse_http_generic_error(response)
.map_err(crate::error::ListCachePoliciesError::unhandled)?;
let error_code = match generic.code() {
Some(code) => code,
None => return Err(crate::error::ListCachePoliciesError::unhandled(generic)),
};
let _error_message = generic.message().map(|msg| msg.to_owned());
Err(match error_code {
"AccessDenied" => crate::error::ListCachePoliciesError {
meta: generic,
kind: crate::error::ListCachePoliciesErrorKind::AccessDenied({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::access_denied::Builder::default();
let _ = response;
output = crate::xml_deser::deser_structure_crate_error_access_denied_xml_err(
response.body().as_ref(),
output,
)
.map_err(crate::error::ListCachePoliciesError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"InvalidArgument" => crate::error::ListCachePoliciesError {
meta: generic,
kind: crate::error::ListCachePoliciesErrorKind::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::ListCachePoliciesError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"NoSuchCachePolicy" => {
crate::error::ListCachePoliciesError {
meta: generic,
kind: crate::error::ListCachePoliciesErrorKind::NoSuchCachePolicy({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::no_such_cache_policy::Builder::default();
let _ = response;
output = crate::xml_deser::deser_structure_crate_error_no_such_cache_policy_xml_err(response.body().as_ref(), output).map_err(crate::error::ListCachePoliciesError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
}
}
_ => crate::error::ListCachePoliciesError::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_access_denied(&self) -> bool
pub fn is_access_denied(&self) -> bool
Returns true
if the error kind is ListCachePoliciesErrorKind::AccessDenied
.
sourcepub fn is_invalid_argument(&self) -> bool
pub fn is_invalid_argument(&self) -> bool
Returns true
if the error kind is ListCachePoliciesErrorKind::InvalidArgument
.
sourcepub fn is_no_such_cache_policy(&self) -> bool
pub fn is_no_such_cache_policy(&self) -> bool
Returns true
if the error kind is ListCachePoliciesErrorKind::NoSuchCachePolicy
.
Trait Implementations§
source§impl Debug for ListCachePoliciesError
impl Debug for ListCachePoliciesError
source§impl Display for ListCachePoliciesError
impl Display for ListCachePoliciesError
source§impl Error for ListCachePoliciesError
impl Error for ListCachePoliciesError
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<ListCachePoliciesError> for Error
impl From<ListCachePoliciesError> for Error
source§fn from(err: ListCachePoliciesError) -> Self
fn from(err: ListCachePoliciesError) -> Self
Converts to this type from the input type.