Struct aws_sdk_appstream::error::EnableUserError
source · #[non_exhaustive]pub struct EnableUserError {
pub kind: EnableUserErrorKind,
/* private fields */
}
Expand description
Error type for the EnableUser
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: EnableUserErrorKind
Kind of error that occurred.
Implementations§
source§impl EnableUserError
impl EnableUserError
sourcepub fn new(kind: EnableUserErrorKind, meta: Error) -> Self
pub fn new(kind: EnableUserErrorKind, meta: Error) -> Self
Creates a new EnableUserError
.
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 EnableUserError::Unhandled
variant from any error type.
Examples found in repository?
src/operation_deser.rs (line 4493)
4486 4487 4488 4489 4490 4491 4492 4493 4494 4495 4496 4497 4498 4499 4500 4501 4502 4503 4504 4505 4506 4507 4508 4509 4510 4511 4512 4513 4514 4515 4516 4517 4518 4519 4520 4521 4522 4523 4524 4525 4526 4527 4528 4529 4530 4531 4532 4533 4534 4535
pub fn parse_enable_user_error(
response: &http::Response<bytes::Bytes>,
) -> std::result::Result<crate::output::EnableUserOutput, crate::error::EnableUserError> {
let generic = crate::json_deser::parse_http_generic_error(response)
.map_err(crate::error::EnableUserError::unhandled)?;
let error_code = match generic.code() {
Some(code) => code,
None => return Err(crate::error::EnableUserError::unhandled(generic)),
};
let _error_message = generic.message().map(|msg| msg.to_owned());
Err(match error_code {
"InvalidAccountStatusException" => crate::error::EnableUserError {
meta: generic,
kind: crate::error::EnableUserErrorKind::InvalidAccountStatusException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output =
crate::error::invalid_account_status_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_invalid_account_status_exception_json_err(response.body().as_ref(), output).map_err(crate::error::EnableUserError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"ResourceNotFoundException" => crate::error::EnableUserError {
meta: generic,
kind: crate::error::EnableUserErrorKind::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::EnableUserError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
_ => crate::error::EnableUserError::generic(generic),
})
}
sourcepub fn generic(err: Error) -> Self
pub fn generic(err: Error) -> Self
Creates the EnableUserError::Unhandled
variant from a aws_smithy_types::Error
.
Examples found in repository?
src/operation_deser.rs (line 4533)
4486 4487 4488 4489 4490 4491 4492 4493 4494 4495 4496 4497 4498 4499 4500 4501 4502 4503 4504 4505 4506 4507 4508 4509 4510 4511 4512 4513 4514 4515 4516 4517 4518 4519 4520 4521 4522 4523 4524 4525 4526 4527 4528 4529 4530 4531 4532 4533 4534 4535
pub fn parse_enable_user_error(
response: &http::Response<bytes::Bytes>,
) -> std::result::Result<crate::output::EnableUserOutput, crate::error::EnableUserError> {
let generic = crate::json_deser::parse_http_generic_error(response)
.map_err(crate::error::EnableUserError::unhandled)?;
let error_code = match generic.code() {
Some(code) => code,
None => return Err(crate::error::EnableUserError::unhandled(generic)),
};
let _error_message = generic.message().map(|msg| msg.to_owned());
Err(match error_code {
"InvalidAccountStatusException" => crate::error::EnableUserError {
meta: generic,
kind: crate::error::EnableUserErrorKind::InvalidAccountStatusException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output =
crate::error::invalid_account_status_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_invalid_account_status_exception_json_err(response.body().as_ref(), output).map_err(crate::error::EnableUserError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"ResourceNotFoundException" => crate::error::EnableUserError {
meta: generic,
kind: crate::error::EnableUserErrorKind::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::EnableUserError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
_ => crate::error::EnableUserError::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_account_status_exception(&self) -> bool
pub fn is_invalid_account_status_exception(&self) -> bool
Returns true
if the error kind is EnableUserErrorKind::InvalidAccountStatusException
.
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 EnableUserErrorKind::ResourceNotFoundException
.
Trait Implementations§
source§impl Debug for EnableUserError
impl Debug for EnableUserError
source§impl Display for EnableUserError
impl Display for EnableUserError
source§impl Error for EnableUserError
impl Error for EnableUserError
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<EnableUserError> for Error
impl From<EnableUserError> for Error
source§fn from(err: EnableUserError) -> Self
fn from(err: EnableUserError) -> Self
Converts to this type from the input type.