Struct aws_sdk_kms::error::DecryptError
source · #[non_exhaustive]pub struct DecryptError {
pub kind: DecryptErrorKind,
/* private fields */
}
Expand description
Error type for the Decrypt
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: DecryptErrorKind
Kind of error that occurred.
Implementations§
source§impl DecryptError
impl DecryptError
sourcepub fn new(kind: DecryptErrorKind, meta: Error) -> Self
pub fn new(kind: DecryptErrorKind, meta: Error) -> Self
Creates a new DecryptError
.
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 DecryptError::Unhandled
variant from any error type.
Examples found in repository?
899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086
pub fn parse_decrypt_error(
response: &http::Response<bytes::Bytes>,
) -> std::result::Result<crate::output::DecryptOutput, crate::error::DecryptError> {
let generic = crate::json_deser::parse_http_generic_error(response)
.map_err(crate::error::DecryptError::unhandled)?;
let error_code = match generic.code() {
Some(code) => code,
None => return Err(crate::error::DecryptError::unhandled(generic)),
};
let _error_message = generic.message().map(|msg| msg.to_owned());
Err(match error_code {
"DependencyTimeoutException" => crate::error::DecryptError {
meta: generic,
kind: crate::error::DecryptErrorKind::DependencyTimeoutException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::dependency_timeout_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_dependency_timeout_exception_json_err(response.body().as_ref(), output).map_err(crate::error::DecryptError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"DisabledException" => {
crate::error::DecryptError {
meta: generic,
kind: crate::error::DecryptErrorKind::DisabledException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::disabled_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_disabled_exception_json_err(response.body().as_ref(), output).map_err(crate::error::DecryptError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
}
}
"IncorrectKeyException" => crate::error::DecryptError {
meta: generic,
kind: crate::error::DecryptErrorKind::IncorrectKeyException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::incorrect_key_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_incorrect_key_exception_json_err(response.body().as_ref(), output).map_err(crate::error::DecryptError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"InvalidCiphertextException" => crate::error::DecryptError {
meta: generic,
kind: crate::error::DecryptErrorKind::InvalidCiphertextException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::invalid_ciphertext_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_invalid_ciphertext_exception_json_err(response.body().as_ref(), output).map_err(crate::error::DecryptError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"InvalidGrantTokenException" => crate::error::DecryptError {
meta: generic,
kind: crate::error::DecryptErrorKind::InvalidGrantTokenException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output =
crate::error::invalid_grant_token_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_invalid_grant_token_exception_json_err(response.body().as_ref(), output).map_err(crate::error::DecryptError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"InvalidKeyUsageException" => crate::error::DecryptError {
meta: generic,
kind: crate::error::DecryptErrorKind::InvalidKeyUsageException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::invalid_key_usage_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_invalid_key_usage_exception_json_err(response.body().as_ref(), output).map_err(crate::error::DecryptError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"KeyUnavailableException" => crate::error::DecryptError {
meta: generic,
kind: crate::error::DecryptErrorKind::KeyUnavailableException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::key_unavailable_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_key_unavailable_exception_json_err(response.body().as_ref(), output).map_err(crate::error::DecryptError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"KMSInternalException" => crate::error::DecryptError {
meta: generic,
kind: crate::error::DecryptErrorKind::KmsInternalException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::kms_internal_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_kms_internal_exception_json_err(response.body().as_ref(), output).map_err(crate::error::DecryptError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"KMSInvalidStateException" => crate::error::DecryptError {
meta: generic,
kind: crate::error::DecryptErrorKind::KmsInvalidStateException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::kms_invalid_state_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_kms_invalid_state_exception_json_err(response.body().as_ref(), output).map_err(crate::error::DecryptError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"NotFoundException" => crate::error::DecryptError {
meta: generic,
kind: crate::error::DecryptErrorKind::NotFoundException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::not_found_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_not_found_exception_json_err(response.body().as_ref(), output).map_err(crate::error::DecryptError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
_ => crate::error::DecryptError::generic(generic),
})
}
sourcepub fn generic(err: Error) -> Self
pub fn generic(err: Error) -> Self
Creates the DecryptError::Unhandled
variant from a aws_smithy_types::Error
.
Examples found in repository?
899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086
pub fn parse_decrypt_error(
response: &http::Response<bytes::Bytes>,
) -> std::result::Result<crate::output::DecryptOutput, crate::error::DecryptError> {
let generic = crate::json_deser::parse_http_generic_error(response)
.map_err(crate::error::DecryptError::unhandled)?;
let error_code = match generic.code() {
Some(code) => code,
None => return Err(crate::error::DecryptError::unhandled(generic)),
};
let _error_message = generic.message().map(|msg| msg.to_owned());
Err(match error_code {
"DependencyTimeoutException" => crate::error::DecryptError {
meta: generic,
kind: crate::error::DecryptErrorKind::DependencyTimeoutException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::dependency_timeout_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_dependency_timeout_exception_json_err(response.body().as_ref(), output).map_err(crate::error::DecryptError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"DisabledException" => {
crate::error::DecryptError {
meta: generic,
kind: crate::error::DecryptErrorKind::DisabledException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::disabled_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_disabled_exception_json_err(response.body().as_ref(), output).map_err(crate::error::DecryptError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
}
}
"IncorrectKeyException" => crate::error::DecryptError {
meta: generic,
kind: crate::error::DecryptErrorKind::IncorrectKeyException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::incorrect_key_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_incorrect_key_exception_json_err(response.body().as_ref(), output).map_err(crate::error::DecryptError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"InvalidCiphertextException" => crate::error::DecryptError {
meta: generic,
kind: crate::error::DecryptErrorKind::InvalidCiphertextException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::invalid_ciphertext_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_invalid_ciphertext_exception_json_err(response.body().as_ref(), output).map_err(crate::error::DecryptError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"InvalidGrantTokenException" => crate::error::DecryptError {
meta: generic,
kind: crate::error::DecryptErrorKind::InvalidGrantTokenException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output =
crate::error::invalid_grant_token_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_invalid_grant_token_exception_json_err(response.body().as_ref(), output).map_err(crate::error::DecryptError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"InvalidKeyUsageException" => crate::error::DecryptError {
meta: generic,
kind: crate::error::DecryptErrorKind::InvalidKeyUsageException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::invalid_key_usage_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_invalid_key_usage_exception_json_err(response.body().as_ref(), output).map_err(crate::error::DecryptError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"KeyUnavailableException" => crate::error::DecryptError {
meta: generic,
kind: crate::error::DecryptErrorKind::KeyUnavailableException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::key_unavailable_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_key_unavailable_exception_json_err(response.body().as_ref(), output).map_err(crate::error::DecryptError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"KMSInternalException" => crate::error::DecryptError {
meta: generic,
kind: crate::error::DecryptErrorKind::KmsInternalException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::kms_internal_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_kms_internal_exception_json_err(response.body().as_ref(), output).map_err(crate::error::DecryptError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"KMSInvalidStateException" => crate::error::DecryptError {
meta: generic,
kind: crate::error::DecryptErrorKind::KmsInvalidStateException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::kms_invalid_state_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_kms_invalid_state_exception_json_err(response.body().as_ref(), output).map_err(crate::error::DecryptError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"NotFoundException" => crate::error::DecryptError {
meta: generic,
kind: crate::error::DecryptErrorKind::NotFoundException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::not_found_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_not_found_exception_json_err(response.body().as_ref(), output).map_err(crate::error::DecryptError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
_ => crate::error::DecryptError::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_dependency_timeout_exception(&self) -> bool
pub fn is_dependency_timeout_exception(&self) -> bool
Returns true
if the error kind is DecryptErrorKind::DependencyTimeoutException
.
sourcepub fn is_disabled_exception(&self) -> bool
pub fn is_disabled_exception(&self) -> bool
Returns true
if the error kind is DecryptErrorKind::DisabledException
.
sourcepub fn is_incorrect_key_exception(&self) -> bool
pub fn is_incorrect_key_exception(&self) -> bool
Returns true
if the error kind is DecryptErrorKind::IncorrectKeyException
.
sourcepub fn is_invalid_ciphertext_exception(&self) -> bool
pub fn is_invalid_ciphertext_exception(&self) -> bool
Returns true
if the error kind is DecryptErrorKind::InvalidCiphertextException
.
sourcepub fn is_invalid_grant_token_exception(&self) -> bool
pub fn is_invalid_grant_token_exception(&self) -> bool
Returns true
if the error kind is DecryptErrorKind::InvalidGrantTokenException
.
sourcepub fn is_invalid_key_usage_exception(&self) -> bool
pub fn is_invalid_key_usage_exception(&self) -> bool
Returns true
if the error kind is DecryptErrorKind::InvalidKeyUsageException
.
Returns true
if the error kind is DecryptErrorKind::KeyUnavailableException
.
sourcepub fn is_kms_internal_exception(&self) -> bool
pub fn is_kms_internal_exception(&self) -> bool
Returns true
if the error kind is DecryptErrorKind::KmsInternalException
.
sourcepub fn is_kms_invalid_state_exception(&self) -> bool
pub fn is_kms_invalid_state_exception(&self) -> bool
Returns true
if the error kind is DecryptErrorKind::KmsInvalidStateException
.
sourcepub fn is_not_found_exception(&self) -> bool
pub fn is_not_found_exception(&self) -> bool
Returns true
if the error kind is DecryptErrorKind::NotFoundException
.