Struct aws_sdk_elasticache::error::StartMigrationError
source · #[non_exhaustive]pub struct StartMigrationError {
pub kind: StartMigrationErrorKind,
/* private fields */
}
Expand description
Error type for the StartMigration
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: StartMigrationErrorKind
Kind of error that occurred.
Implementations§
source§impl StartMigrationError
impl StartMigrationError
sourcepub fn new(kind: StartMigrationErrorKind, meta: Error) -> Self
pub fn new(kind: StartMigrationErrorKind, meta: Error) -> Self
Creates a new StartMigrationError
.
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 StartMigrationError::Unhandled
variant from any error type.
Examples found in repository?
8174 8175 8176 8177 8178 8179 8180 8181 8182 8183 8184 8185 8186 8187 8188 8189 8190 8191 8192 8193 8194 8195 8196 8197 8198 8199 8200 8201 8202 8203 8204 8205 8206 8207 8208 8209 8210 8211 8212 8213 8214 8215 8216 8217 8218 8219 8220 8221 8222 8223 8224 8225 8226 8227 8228 8229 8230 8231 8232 8233 8234 8235 8236 8237 8238 8239 8240 8241 8242 8243 8244 8245 8246 8247 8248 8249 8250 8251 8252 8253 8254 8255 8256 8257 8258 8259 8260
pub fn parse_start_migration_error(
response: &http::Response<bytes::Bytes>,
) -> std::result::Result<crate::output::StartMigrationOutput, crate::error::StartMigrationError> {
let generic = crate::xml_deser::parse_http_generic_error(response)
.map_err(crate::error::StartMigrationError::unhandled)?;
let error_code = match generic.code() {
Some(code) => code,
None => return Err(crate::error::StartMigrationError::unhandled(generic)),
};
let _error_message = generic.message().map(|msg| msg.to_owned());
Err(match error_code {
"InvalidParameterValue" => crate::error::StartMigrationError {
meta: generic,
kind: crate::error::StartMigrationErrorKind::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::StartMigrationError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"InvalidReplicationGroupState" => crate::error::StartMigrationError {
meta: generic,
kind: crate::error::StartMigrationErrorKind::InvalidReplicationGroupStateFault({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output =
crate::error::invalid_replication_group_state_fault::Builder::default();
let _ = response;
output = crate::xml_deser::deser_structure_crate_error_invalid_replication_group_state_fault_xml_err(response.body().as_ref(), output).map_err(crate::error::StartMigrationError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"ReplicationGroupAlreadyUnderMigrationFault" => crate::error::StartMigrationError {
meta: generic,
kind: crate::error::StartMigrationErrorKind::ReplicationGroupAlreadyUnderMigrationFault(
{
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]let mut output = crate::error::replication_group_already_under_migration_fault::Builder::default();
let _ = response;
output = crate::xml_deser::deser_structure_crate_error_replication_group_already_under_migration_fault_xml_err(response.body().as_ref(), output).map_err(crate::error::StartMigrationError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
},
),
},
"ReplicationGroupNotFoundFault" => crate::error::StartMigrationError {
meta: generic,
kind: crate::error::StartMigrationErrorKind::ReplicationGroupNotFoundFault({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output =
crate::error::replication_group_not_found_fault::Builder::default();
let _ = response;
output = crate::xml_deser::deser_structure_crate_error_replication_group_not_found_fault_xml_err(response.body().as_ref(), output).map_err(crate::error::StartMigrationError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
_ => crate::error::StartMigrationError::generic(generic),
})
}
sourcepub fn generic(err: Error) -> Self
pub fn generic(err: Error) -> Self
Creates the StartMigrationError::Unhandled
variant from a aws_smithy_types::Error
.
Examples found in repository?
8174 8175 8176 8177 8178 8179 8180 8181 8182 8183 8184 8185 8186 8187 8188 8189 8190 8191 8192 8193 8194 8195 8196 8197 8198 8199 8200 8201 8202 8203 8204 8205 8206 8207 8208 8209 8210 8211 8212 8213 8214 8215 8216 8217 8218 8219 8220 8221 8222 8223 8224 8225 8226 8227 8228 8229 8230 8231 8232 8233 8234 8235 8236 8237 8238 8239 8240 8241 8242 8243 8244 8245 8246 8247 8248 8249 8250 8251 8252 8253 8254 8255 8256 8257 8258 8259 8260
pub fn parse_start_migration_error(
response: &http::Response<bytes::Bytes>,
) -> std::result::Result<crate::output::StartMigrationOutput, crate::error::StartMigrationError> {
let generic = crate::xml_deser::parse_http_generic_error(response)
.map_err(crate::error::StartMigrationError::unhandled)?;
let error_code = match generic.code() {
Some(code) => code,
None => return Err(crate::error::StartMigrationError::unhandled(generic)),
};
let _error_message = generic.message().map(|msg| msg.to_owned());
Err(match error_code {
"InvalidParameterValue" => crate::error::StartMigrationError {
meta: generic,
kind: crate::error::StartMigrationErrorKind::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::StartMigrationError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"InvalidReplicationGroupState" => crate::error::StartMigrationError {
meta: generic,
kind: crate::error::StartMigrationErrorKind::InvalidReplicationGroupStateFault({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output =
crate::error::invalid_replication_group_state_fault::Builder::default();
let _ = response;
output = crate::xml_deser::deser_structure_crate_error_invalid_replication_group_state_fault_xml_err(response.body().as_ref(), output).map_err(crate::error::StartMigrationError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"ReplicationGroupAlreadyUnderMigrationFault" => crate::error::StartMigrationError {
meta: generic,
kind: crate::error::StartMigrationErrorKind::ReplicationGroupAlreadyUnderMigrationFault(
{
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]let mut output = crate::error::replication_group_already_under_migration_fault::Builder::default();
let _ = response;
output = crate::xml_deser::deser_structure_crate_error_replication_group_already_under_migration_fault_xml_err(response.body().as_ref(), output).map_err(crate::error::StartMigrationError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
},
),
},
"ReplicationGroupNotFoundFault" => crate::error::StartMigrationError {
meta: generic,
kind: crate::error::StartMigrationErrorKind::ReplicationGroupNotFoundFault({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output =
crate::error::replication_group_not_found_fault::Builder::default();
let _ = response;
output = crate::xml_deser::deser_structure_crate_error_replication_group_not_found_fault_xml_err(response.body().as_ref(), output).map_err(crate::error::StartMigrationError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
_ => crate::error::StartMigrationError::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_parameter_value_exception(&self) -> bool
pub fn is_invalid_parameter_value_exception(&self) -> bool
Returns true
if the error kind is StartMigrationErrorKind::InvalidParameterValueException
.
sourcepub fn is_invalid_replication_group_state_fault(&self) -> bool
pub fn is_invalid_replication_group_state_fault(&self) -> bool
Returns true
if the error kind is StartMigrationErrorKind::InvalidReplicationGroupStateFault
.
sourcepub fn is_replication_group_already_under_migration_fault(&self) -> bool
pub fn is_replication_group_already_under_migration_fault(&self) -> bool
Returns true
if the error kind is StartMigrationErrorKind::ReplicationGroupAlreadyUnderMigrationFault
.
sourcepub fn is_replication_group_not_found_fault(&self) -> bool
pub fn is_replication_group_not_found_fault(&self) -> bool
Returns true
if the error kind is StartMigrationErrorKind::ReplicationGroupNotFoundFault
.