Struct aws_sdk_connect::error::ReleasePhoneNumberError
source · #[non_exhaustive]pub struct ReleasePhoneNumberError {
pub kind: ReleasePhoneNumberErrorKind,
/* private fields */
}
Expand description
Error type for the ReleasePhoneNumber
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: ReleasePhoneNumberErrorKind
Kind of error that occurred.
Implementations§
source§impl ReleasePhoneNumberError
impl ReleasePhoneNumberError
sourcepub fn new(kind: ReleasePhoneNumberErrorKind, meta: Error) -> Self
pub fn new(kind: ReleasePhoneNumberErrorKind, meta: Error) -> Self
Creates a new ReleasePhoneNumberError
.
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 ReleasePhoneNumberError::Unhandled
variant from any error type.
Examples found in repository?
13150 13151 13152 13153 13154 13155 13156 13157 13158 13159 13160 13161 13162 13163 13164 13165 13166 13167 13168 13169 13170 13171 13172 13173 13174 13175 13176 13177 13178 13179 13180 13181 13182 13183 13184 13185 13186 13187 13188 13189 13190 13191 13192 13193 13194 13195 13196 13197 13198 13199 13200 13201 13202 13203 13204 13205 13206 13207 13208 13209 13210 13211 13212 13213 13214 13215 13216 13217 13218 13219 13220 13221 13222 13223 13224 13225 13226 13227 13228 13229 13230 13231 13232 13233 13234 13235 13236 13237 13238 13239 13240 13241 13242 13243 13244 13245 13246 13247 13248 13249 13250 13251 13252 13253 13254 13255 13256 13257 13258 13259 13260 13261 13262 13263 13264 13265 13266 13267 13268 13269 13270 13271 13272 13273 13274 13275 13276 13277 13278 13279 13280 13281 13282 13283 13284 13285 13286
pub fn parse_release_phone_number_error(
response: &http::Response<bytes::Bytes>,
) -> std::result::Result<
crate::output::ReleasePhoneNumberOutput,
crate::error::ReleasePhoneNumberError,
> {
let generic = crate::json_deser::parse_http_generic_error(response)
.map_err(crate::error::ReleasePhoneNumberError::unhandled)?;
let error_code = match generic.code() {
Some(code) => code,
None => return Err(crate::error::ReleasePhoneNumberError::unhandled(generic)),
};
let _error_message = generic.message().map(|msg| msg.to_owned());
Err(match error_code {
"AccessDeniedException" => crate::error::ReleasePhoneNumberError {
meta: generic,
kind: crate::error::ReleasePhoneNumberErrorKind::AccessDeniedException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::access_denied_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_access_denied_exception_json_err(response.body().as_ref(), output).map_err(crate::error::ReleasePhoneNumberError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"IdempotencyException" => crate::error::ReleasePhoneNumberError {
meta: generic,
kind: crate::error::ReleasePhoneNumberErrorKind::IdempotencyException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::idempotency_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_idempotency_exception_json_err(response.body().as_ref(), output).map_err(crate::error::ReleasePhoneNumberError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"InternalServiceException" => crate::error::ReleasePhoneNumberError {
meta: generic,
kind: crate::error::ReleasePhoneNumberErrorKind::InternalServiceException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::internal_service_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_internal_service_exception_json_err(response.body().as_ref(), output).map_err(crate::error::ReleasePhoneNumberError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"InvalidParameterException" => crate::error::ReleasePhoneNumberError {
meta: generic,
kind: crate::error::ReleasePhoneNumberErrorKind::InvalidParameterException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::invalid_parameter_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_invalid_parameter_exception_json_err(response.body().as_ref(), output).map_err(crate::error::ReleasePhoneNumberError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"ResourceInUseException" => crate::error::ReleasePhoneNumberError {
meta: generic,
kind: crate::error::ReleasePhoneNumberErrorKind::ResourceInUseException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::resource_in_use_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_resource_in_use_exception_json_err(response.body().as_ref(), output).map_err(crate::error::ReleasePhoneNumberError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"ResourceNotFoundException" => crate::error::ReleasePhoneNumberError {
meta: generic,
kind: crate::error::ReleasePhoneNumberErrorKind::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::ReleasePhoneNumberError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"ThrottlingException" => crate::error::ReleasePhoneNumberError {
meta: generic,
kind: crate::error::ReleasePhoneNumberErrorKind::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::ReleasePhoneNumberError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
_ => crate::error::ReleasePhoneNumberError::generic(generic),
})
}
sourcepub fn generic(err: Error) -> Self
pub fn generic(err: Error) -> Self
Creates the ReleasePhoneNumberError::Unhandled
variant from a aws_smithy_types::Error
.
Examples found in repository?
13150 13151 13152 13153 13154 13155 13156 13157 13158 13159 13160 13161 13162 13163 13164 13165 13166 13167 13168 13169 13170 13171 13172 13173 13174 13175 13176 13177 13178 13179 13180 13181 13182 13183 13184 13185 13186 13187 13188 13189 13190 13191 13192 13193 13194 13195 13196 13197 13198 13199 13200 13201 13202 13203 13204 13205 13206 13207 13208 13209 13210 13211 13212 13213 13214 13215 13216 13217 13218 13219 13220 13221 13222 13223 13224 13225 13226 13227 13228 13229 13230 13231 13232 13233 13234 13235 13236 13237 13238 13239 13240 13241 13242 13243 13244 13245 13246 13247 13248 13249 13250 13251 13252 13253 13254 13255 13256 13257 13258 13259 13260 13261 13262 13263 13264 13265 13266 13267 13268 13269 13270 13271 13272 13273 13274 13275 13276 13277 13278 13279 13280 13281 13282 13283 13284 13285 13286
pub fn parse_release_phone_number_error(
response: &http::Response<bytes::Bytes>,
) -> std::result::Result<
crate::output::ReleasePhoneNumberOutput,
crate::error::ReleasePhoneNumberError,
> {
let generic = crate::json_deser::parse_http_generic_error(response)
.map_err(crate::error::ReleasePhoneNumberError::unhandled)?;
let error_code = match generic.code() {
Some(code) => code,
None => return Err(crate::error::ReleasePhoneNumberError::unhandled(generic)),
};
let _error_message = generic.message().map(|msg| msg.to_owned());
Err(match error_code {
"AccessDeniedException" => crate::error::ReleasePhoneNumberError {
meta: generic,
kind: crate::error::ReleasePhoneNumberErrorKind::AccessDeniedException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::access_denied_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_access_denied_exception_json_err(response.body().as_ref(), output).map_err(crate::error::ReleasePhoneNumberError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"IdempotencyException" => crate::error::ReleasePhoneNumberError {
meta: generic,
kind: crate::error::ReleasePhoneNumberErrorKind::IdempotencyException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::idempotency_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_idempotency_exception_json_err(response.body().as_ref(), output).map_err(crate::error::ReleasePhoneNumberError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"InternalServiceException" => crate::error::ReleasePhoneNumberError {
meta: generic,
kind: crate::error::ReleasePhoneNumberErrorKind::InternalServiceException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::internal_service_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_internal_service_exception_json_err(response.body().as_ref(), output).map_err(crate::error::ReleasePhoneNumberError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"InvalidParameterException" => crate::error::ReleasePhoneNumberError {
meta: generic,
kind: crate::error::ReleasePhoneNumberErrorKind::InvalidParameterException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::invalid_parameter_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_invalid_parameter_exception_json_err(response.body().as_ref(), output).map_err(crate::error::ReleasePhoneNumberError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"ResourceInUseException" => crate::error::ReleasePhoneNumberError {
meta: generic,
kind: crate::error::ReleasePhoneNumberErrorKind::ResourceInUseException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::resource_in_use_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_resource_in_use_exception_json_err(response.body().as_ref(), output).map_err(crate::error::ReleasePhoneNumberError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"ResourceNotFoundException" => crate::error::ReleasePhoneNumberError {
meta: generic,
kind: crate::error::ReleasePhoneNumberErrorKind::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::ReleasePhoneNumberError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"ThrottlingException" => crate::error::ReleasePhoneNumberError {
meta: generic,
kind: crate::error::ReleasePhoneNumberErrorKind::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::ReleasePhoneNumberError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
_ => crate::error::ReleasePhoneNumberError::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_exception(&self) -> bool
pub fn is_access_denied_exception(&self) -> bool
Returns true
if the error kind is ReleasePhoneNumberErrorKind::AccessDeniedException
.
sourcepub fn is_idempotency_exception(&self) -> bool
pub fn is_idempotency_exception(&self) -> bool
Returns true
if the error kind is ReleasePhoneNumberErrorKind::IdempotencyException
.
sourcepub fn is_internal_service_exception(&self) -> bool
pub fn is_internal_service_exception(&self) -> bool
Returns true
if the error kind is ReleasePhoneNumberErrorKind::InternalServiceException
.
sourcepub fn is_invalid_parameter_exception(&self) -> bool
pub fn is_invalid_parameter_exception(&self) -> bool
Returns true
if the error kind is ReleasePhoneNumberErrorKind::InvalidParameterException
.
sourcepub fn is_resource_in_use_exception(&self) -> bool
pub fn is_resource_in_use_exception(&self) -> bool
Returns true
if the error kind is ReleasePhoneNumberErrorKind::ResourceInUseException
.
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 ReleasePhoneNumberErrorKind::ResourceNotFoundException
.
sourcepub fn is_throttling_exception(&self) -> bool
pub fn is_throttling_exception(&self) -> bool
Returns true
if the error kind is ReleasePhoneNumberErrorKind::ThrottlingException
.