#[non_exhaustive]pub struct StopSentimentDetectionJobError {
pub kind: StopSentimentDetectionJobErrorKind,
/* private fields */
}Expand description
Error type for the StopSentimentDetectionJob 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: StopSentimentDetectionJobErrorKindKind of error that occurred.
Implementations§
source§impl StopSentimentDetectionJobError
impl StopSentimentDetectionJobError
sourcepub fn new(kind: StopSentimentDetectionJobErrorKind, meta: Error) -> Self
pub fn new(kind: StopSentimentDetectionJobErrorKind, meta: Error) -> Self
Creates a new StopSentimentDetectionJobError.
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 StopSentimentDetectionJobError::Unhandled variant from any error type.
Examples found in repository?
src/operation_deser.rs (lines 7830-7832)
7819 7820 7821 7822 7823 7824 7825 7826 7827 7828 7829 7830 7831 7832 7833 7834 7835 7836 7837 7838 7839 7840 7841 7842 7843 7844 7845 7846 7847 7848 7849 7850 7851 7852 7853 7854 7855 7856 7857 7858 7859 7860 7861 7862 7863 7864 7865 7866 7867 7868 7869 7870 7871 7872 7873 7874 7875 7876 7877 7878 7879 7880 7881 7882 7883 7884 7885 7886 7887 7888 7889 7890 7891
pub fn parse_stop_sentiment_detection_job_error(
response: &http::Response<bytes::Bytes>,
) -> std::result::Result<
crate::output::StopSentimentDetectionJobOutput,
crate::error::StopSentimentDetectionJobError,
> {
let generic = crate::json_deser::parse_http_generic_error(response)
.map_err(crate::error::StopSentimentDetectionJobError::unhandled)?;
let error_code = match generic.code() {
Some(code) => code,
None => {
return Err(crate::error::StopSentimentDetectionJobError::unhandled(
generic,
))
}
};
let _error_message = generic.message().map(|msg| msg.to_owned());
Err(match error_code {
"InternalServerException" => crate::error::StopSentimentDetectionJobError {
meta: generic,
kind: crate::error::StopSentimentDetectionJobErrorKind::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::StopSentimentDetectionJobError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"InvalidRequestException" => crate::error::StopSentimentDetectionJobError {
meta: generic,
kind: crate::error::StopSentimentDetectionJobErrorKind::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::StopSentimentDetectionJobError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"JobNotFoundException" => crate::error::StopSentimentDetectionJobError {
meta: generic,
kind: crate::error::StopSentimentDetectionJobErrorKind::JobNotFoundException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::job_not_found_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_job_not_found_exception_json_err(response.body().as_ref(), output).map_err(crate::error::StopSentimentDetectionJobError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
_ => crate::error::StopSentimentDetectionJobError::generic(generic),
})
}sourcepub fn generic(err: Error) -> Self
pub fn generic(err: Error) -> Self
Creates the StopSentimentDetectionJobError::Unhandled variant from a aws_smithy_types::Error.
Examples found in repository?
src/operation_deser.rs (line 7889)
7819 7820 7821 7822 7823 7824 7825 7826 7827 7828 7829 7830 7831 7832 7833 7834 7835 7836 7837 7838 7839 7840 7841 7842 7843 7844 7845 7846 7847 7848 7849 7850 7851 7852 7853 7854 7855 7856 7857 7858 7859 7860 7861 7862 7863 7864 7865 7866 7867 7868 7869 7870 7871 7872 7873 7874 7875 7876 7877 7878 7879 7880 7881 7882 7883 7884 7885 7886 7887 7888 7889 7890 7891
pub fn parse_stop_sentiment_detection_job_error(
response: &http::Response<bytes::Bytes>,
) -> std::result::Result<
crate::output::StopSentimentDetectionJobOutput,
crate::error::StopSentimentDetectionJobError,
> {
let generic = crate::json_deser::parse_http_generic_error(response)
.map_err(crate::error::StopSentimentDetectionJobError::unhandled)?;
let error_code = match generic.code() {
Some(code) => code,
None => {
return Err(crate::error::StopSentimentDetectionJobError::unhandled(
generic,
))
}
};
let _error_message = generic.message().map(|msg| msg.to_owned());
Err(match error_code {
"InternalServerException" => crate::error::StopSentimentDetectionJobError {
meta: generic,
kind: crate::error::StopSentimentDetectionJobErrorKind::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::StopSentimentDetectionJobError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"InvalidRequestException" => crate::error::StopSentimentDetectionJobError {
meta: generic,
kind: crate::error::StopSentimentDetectionJobErrorKind::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::StopSentimentDetectionJobError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"JobNotFoundException" => crate::error::StopSentimentDetectionJobError {
meta: generic,
kind: crate::error::StopSentimentDetectionJobErrorKind::JobNotFoundException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::job_not_found_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_job_not_found_exception_json_err(response.body().as_ref(), output).map_err(crate::error::StopSentimentDetectionJobError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
_ => crate::error::StopSentimentDetectionJobError::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 StopSentimentDetectionJobErrorKind::InternalServerException.
sourcepub fn is_invalid_request_exception(&self) -> bool
pub fn is_invalid_request_exception(&self) -> bool
Returns true if the error kind is StopSentimentDetectionJobErrorKind::InvalidRequestException.
sourcepub fn is_job_not_found_exception(&self) -> bool
pub fn is_job_not_found_exception(&self) -> bool
Returns true if the error kind is StopSentimentDetectionJobErrorKind::JobNotFoundException.
Trait Implementations§
source§impl Error for StopSentimentDetectionJobError
impl Error for StopSentimentDetectionJobError
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<StopSentimentDetectionJobError> for Error
impl From<StopSentimentDetectionJobError> for Error
source§fn from(err: StopSentimentDetectionJobError) -> Self
fn from(err: StopSentimentDetectionJobError) -> Self
Converts to this type from the input type.