Struct aws_sdk_comprehend::error::DetectKeyPhrasesError
source · #[non_exhaustive]pub struct DetectKeyPhrasesError {
pub kind: DetectKeyPhrasesErrorKind,
/* private fields */
}Expand description
Error type for the DetectKeyPhrases 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: DetectKeyPhrasesErrorKindKind of error that occurred.
Implementations§
source§impl DetectKeyPhrasesError
impl DetectKeyPhrasesError
sourcepub fn new(kind: DetectKeyPhrasesErrorKind, meta: Error) -> Self
pub fn new(kind: DetectKeyPhrasesErrorKind, meta: Error) -> Self
Creates a new DetectKeyPhrasesError.
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 DetectKeyPhrasesError::Unhandled variant from any error type.
Examples found in repository?
3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 3660 3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 3691 3692 3693 3694 3695 3696 3697 3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 3718 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 3729 3730 3731
pub fn parse_detect_key_phrases_error(
response: &http::Response<bytes::Bytes>,
) -> std::result::Result<crate::output::DetectKeyPhrasesOutput, crate::error::DetectKeyPhrasesError>
{
let generic = crate::json_deser::parse_http_generic_error(response)
.map_err(crate::error::DetectKeyPhrasesError::unhandled)?;
let error_code = match generic.code() {
Some(code) => code,
None => return Err(crate::error::DetectKeyPhrasesError::unhandled(generic)),
};
let _error_message = generic.message().map(|msg| msg.to_owned());
Err(match error_code {
"InternalServerException" => crate::error::DetectKeyPhrasesError {
meta: generic,
kind: crate::error::DetectKeyPhrasesErrorKind::InternalServerException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::internal_server_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_internal_server_exception_json_err(response.body().as_ref(), output).map_err(crate::error::DetectKeyPhrasesError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"InvalidRequestException" => crate::error::DetectKeyPhrasesError {
meta: generic,
kind: crate::error::DetectKeyPhrasesErrorKind::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::DetectKeyPhrasesError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"TextSizeLimitExceededException" => crate::error::DetectKeyPhrasesError {
meta: generic,
kind: crate::error::DetectKeyPhrasesErrorKind::TextSizeLimitExceededException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output =
crate::error::text_size_limit_exceeded_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_text_size_limit_exceeded_exception_json_err(response.body().as_ref(), output).map_err(crate::error::DetectKeyPhrasesError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"UnsupportedLanguageException" => crate::error::DetectKeyPhrasesError {
meta: generic,
kind: crate::error::DetectKeyPhrasesErrorKind::UnsupportedLanguageException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output =
crate::error::unsupported_language_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_unsupported_language_exception_json_err(response.body().as_ref(), output).map_err(crate::error::DetectKeyPhrasesError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
_ => crate::error::DetectKeyPhrasesError::generic(generic),
})
}sourcepub fn generic(err: Error) -> Self
pub fn generic(err: Error) -> Self
Creates the DetectKeyPhrasesError::Unhandled variant from a aws_smithy_types::Error.
Examples found in repository?
3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 3660 3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 3691 3692 3693 3694 3695 3696 3697 3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 3718 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 3729 3730 3731
pub fn parse_detect_key_phrases_error(
response: &http::Response<bytes::Bytes>,
) -> std::result::Result<crate::output::DetectKeyPhrasesOutput, crate::error::DetectKeyPhrasesError>
{
let generic = crate::json_deser::parse_http_generic_error(response)
.map_err(crate::error::DetectKeyPhrasesError::unhandled)?;
let error_code = match generic.code() {
Some(code) => code,
None => return Err(crate::error::DetectKeyPhrasesError::unhandled(generic)),
};
let _error_message = generic.message().map(|msg| msg.to_owned());
Err(match error_code {
"InternalServerException" => crate::error::DetectKeyPhrasesError {
meta: generic,
kind: crate::error::DetectKeyPhrasesErrorKind::InternalServerException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::internal_server_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_internal_server_exception_json_err(response.body().as_ref(), output).map_err(crate::error::DetectKeyPhrasesError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"InvalidRequestException" => crate::error::DetectKeyPhrasesError {
meta: generic,
kind: crate::error::DetectKeyPhrasesErrorKind::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::DetectKeyPhrasesError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"TextSizeLimitExceededException" => crate::error::DetectKeyPhrasesError {
meta: generic,
kind: crate::error::DetectKeyPhrasesErrorKind::TextSizeLimitExceededException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output =
crate::error::text_size_limit_exceeded_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_text_size_limit_exceeded_exception_json_err(response.body().as_ref(), output).map_err(crate::error::DetectKeyPhrasesError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"UnsupportedLanguageException" => crate::error::DetectKeyPhrasesError {
meta: generic,
kind: crate::error::DetectKeyPhrasesErrorKind::UnsupportedLanguageException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output =
crate::error::unsupported_language_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_unsupported_language_exception_json_err(response.body().as_ref(), output).map_err(crate::error::DetectKeyPhrasesError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
_ => crate::error::DetectKeyPhrasesError::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_internal_server_exception(&self) -> bool
pub fn is_internal_server_exception(&self) -> bool
Returns true if the error kind is DetectKeyPhrasesErrorKind::InternalServerException.
sourcepub fn is_invalid_request_exception(&self) -> bool
pub fn is_invalid_request_exception(&self) -> bool
Returns true if the error kind is DetectKeyPhrasesErrorKind::InvalidRequestException.
sourcepub fn is_text_size_limit_exceeded_exception(&self) -> bool
pub fn is_text_size_limit_exceeded_exception(&self) -> bool
Returns true if the error kind is DetectKeyPhrasesErrorKind::TextSizeLimitExceededException.
sourcepub fn is_unsupported_language_exception(&self) -> bool
pub fn is_unsupported_language_exception(&self) -> bool
Returns true if the error kind is DetectKeyPhrasesErrorKind::UnsupportedLanguageException.