Struct aws_sdk_lambda::error::InvokeError
source · #[non_exhaustive]pub struct InvokeError {
pub kind: InvokeErrorKind,
/* private fields */
}
Expand description
Error type for the Invoke
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: InvokeErrorKind
Kind of error that occurred.
Implementations§
source§impl InvokeError
impl InvokeError
sourcepub fn new(kind: InvokeErrorKind, meta: Error) -> Self
pub fn new(kind: InvokeErrorKind, meta: Error) -> Self
Creates a new InvokeError
.
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 InvokeError::Unhandled
variant from any error type.
Examples found in repository?
3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 3861 3862 3863 3864 3865 3866 3867 3868 3869 3870 3871 3872 3873 3874 3875 3876 3877 3878 3879 3880 3881 3882 3883 3884 3885 3886 3887 3888 3889 3890 3891 3892 3893 3894 3895 3896 3897 3898 3899 3900 3901 3902 3903 3904 3905 3906 3907 3908 3909 3910 3911 3912 3913 3914 3915 3916 3917 3918 3919 3920 3921 3922 3923 3924 3925 3926 3927 3928 3929 3930 3931 3932 3933 3934 3935 3936 3937 3938 3939 3940 3941 3942 3943 3944 3945 3946 3947 3948 3949 3950 3951 3952 3953 3954 3955 3956 3957 3958 3959 3960 3961 3962 3963 3964 3965 3966 3967 3968 3969 3970 3971 3972 3973 3974 3975 3976 3977 3978 3979 3980 3981 3982 3983 3984 3985 3986 3987 3988 3989 3990 3991 3992 3993 3994 3995 3996 3997 3998 3999 4000 4001 4002 4003 4004 4005 4006 4007 4008 4009 4010 4011 4012 4013 4014 4015 4016 4017 4018 4019 4020 4021 4022 4023 4024 4025 4026 4027 4028 4029 4030 4031 4032 4033 4034 4035 4036 4037 4038 4039 4040 4041 4042 4043 4044 4045 4046 4047 4048 4049 4050 4051 4052 4053 4054 4055 4056 4057 4058 4059 4060 4061 4062 4063 4064 4065 4066 4067 4068 4069 4070 4071 4072 4073 4074 4075 4076 4077 4078 4079 4080 4081 4082 4083 4084 4085 4086 4087 4088 4089 4090 4091 4092 4093 4094 4095 4096 4097 4098 4099 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 4120 4121 4122 4123 4124 4125 4126 4127 4128 4129 4130 4131 4132 4133 4134 4135 4136 4137 4138 4139 4140 4141 4142 4143 4144 4145 4146 4147 4148 4149 4150 4151 4152 4153 4154 4155 4156 4157 4158 4159 4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 4180 4181 4182 4183 4184 4185 4186 4187 4188 4189 4190 4191 4192 4193 4194 4195 4196 4197 4198 4199 4200 4201 4202 4203 4204 4205 4206 4207 4208 4209 4210 4211 4212 4213 4214 4215 4216 4217 4218 4219 4220 4221 4222 4223 4224 4225 4226 4227 4228 4229 4230 4231 4232 4233 4234 4235 4236 4237 4238 4239 4240 4241 4242 4243 4244 4245 4246 4247 4248 4249 4250 4251 4252 4253 4254 4255 4256 4257 4258 4259 4260 4261 4262 4263 4264 4265 4266 4267 4268 4269 4270 4271 4272 4273 4274 4275 4276 4277 4278 4279 4280 4281 4282 4283 4284 4285 4286 4287 4288 4289 4290 4291 4292 4293 4294 4295 4296 4297 4298 4299 4300 4301 4302 4303 4304 4305 4306 4307 4308 4309 4310 4311 4312 4313 4314 4315 4316 4317 4318 4319 4320 4321 4322 4323 4324 4325 4326 4327 4328 4329 4330 4331 4332 4333 4334 4335 4336 4337 4338 4339 4340 4341 4342 4343 4344 4345 4346
pub fn parse_invoke_error(
response: &http::Response<bytes::Bytes>,
) -> std::result::Result<crate::output::InvokeOutput, crate::error::InvokeError> {
let generic = crate::json_deser::parse_http_generic_error(response)
.map_err(crate::error::InvokeError::unhandled)?;
let error_code = match generic.code() {
Some(code) => code,
None => return Err(crate::error::InvokeError::unhandled(generic)),
};
let _error_message = generic.message().map(|msg| msg.to_owned());
Err(match error_code {
"EC2AccessDeniedException" => crate::error::InvokeError {
meta: generic,
kind: crate::error::InvokeErrorKind::Ec2AccessDeniedException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::ec2_access_denied_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_ec2_access_denied_exception_json_err(response.body().as_ref(), output).map_err(crate::error::InvokeError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"EC2ThrottledException" => crate::error::InvokeError {
meta: generic,
kind: crate::error::InvokeErrorKind::Ec2ThrottledException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::ec2_throttled_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_ec2_throttled_exception_json_err(response.body().as_ref(), output).map_err(crate::error::InvokeError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"EC2UnexpectedException" => crate::error::InvokeError {
meta: generic,
kind: crate::error::InvokeErrorKind::Ec2UnexpectedException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::ec2_unexpected_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_ec2_unexpected_exception_json_err(response.body().as_ref(), output).map_err(crate::error::InvokeError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"EFSIOException" => {
crate::error::InvokeError {
meta: generic,
kind: crate::error::InvokeErrorKind::EfsioException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::efsio_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_efsio_exception_json_err(response.body().as_ref(), output).map_err(crate::error::InvokeError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
}
}
"EFSMountConnectivityException" => crate::error::InvokeError {
meta: generic,
kind: crate::error::InvokeErrorKind::EfsMountConnectivityException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output =
crate::error::efs_mount_connectivity_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_efs_mount_connectivity_exception_json_err(response.body().as_ref(), output).map_err(crate::error::InvokeError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"EFSMountFailureException" => crate::error::InvokeError {
meta: generic,
kind: crate::error::InvokeErrorKind::EfsMountFailureException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::efs_mount_failure_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_efs_mount_failure_exception_json_err(response.body().as_ref(), output).map_err(crate::error::InvokeError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"EFSMountTimeoutException" => crate::error::InvokeError {
meta: generic,
kind: crate::error::InvokeErrorKind::EfsMountTimeoutException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::efs_mount_timeout_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_efs_mount_timeout_exception_json_err(response.body().as_ref(), output).map_err(crate::error::InvokeError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"ENILimitReachedException" => crate::error::InvokeError {
meta: generic,
kind: crate::error::InvokeErrorKind::EniLimitReachedException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::eni_limit_reached_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_eni_limit_reached_exception_json_err(response.body().as_ref(), output).map_err(crate::error::InvokeError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"InvalidParameterValueException" => crate::error::InvokeError {
meta: generic,
kind: crate::error::InvokeErrorKind::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::json_deser::deser_structure_crate_error_invalid_parameter_value_exception_json_err(response.body().as_ref(), output).map_err(crate::error::InvokeError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"InvalidRequestContentException" => crate::error::InvokeError {
meta: generic,
kind: crate::error::InvokeErrorKind::InvalidRequestContentException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output =
crate::error::invalid_request_content_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_invalid_request_content_exception_json_err(response.body().as_ref(), output).map_err(crate::error::InvokeError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"InvalidRuntimeException" => crate::error::InvokeError {
meta: generic,
kind: crate::error::InvokeErrorKind::InvalidRuntimeException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::invalid_runtime_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_invalid_runtime_exception_json_err(response.body().as_ref(), output).map_err(crate::error::InvokeError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"InvalidSecurityGroupIDException" => crate::error::InvokeError {
meta: generic,
kind: crate::error::InvokeErrorKind::InvalidSecurityGroupIdException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output =
crate::error::invalid_security_group_id_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_invalid_security_group_id_exception_json_err(response.body().as_ref(), output).map_err(crate::error::InvokeError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"InvalidSubnetIDException" => crate::error::InvokeError {
meta: generic,
kind: crate::error::InvokeErrorKind::InvalidSubnetIdException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::invalid_subnet_id_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_invalid_subnet_id_exception_json_err(response.body().as_ref(), output).map_err(crate::error::InvokeError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"InvalidZipFileException" => crate::error::InvokeError {
meta: generic,
kind: crate::error::InvokeErrorKind::InvalidZipFileException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::invalid_zip_file_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_invalid_zip_file_exception_json_err(response.body().as_ref(), output).map_err(crate::error::InvokeError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"KMSAccessDeniedException" => crate::error::InvokeError {
meta: generic,
kind: crate::error::InvokeErrorKind::KmsAccessDeniedException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::kms_access_denied_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_kms_access_denied_exception_json_err(response.body().as_ref(), output).map_err(crate::error::InvokeError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"KMSDisabledException" => crate::error::InvokeError {
meta: generic,
kind: crate::error::InvokeErrorKind::KmsDisabledException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::kms_disabled_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_kms_disabled_exception_json_err(response.body().as_ref(), output).map_err(crate::error::InvokeError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"KMSInvalidStateException" => crate::error::InvokeError {
meta: generic,
kind: crate::error::InvokeErrorKind::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::InvokeError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"KMSNotFoundException" => crate::error::InvokeError {
meta: generic,
kind: crate::error::InvokeErrorKind::KmsNotFoundException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::kms_not_found_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_kms_not_found_exception_json_err(response.body().as_ref(), output).map_err(crate::error::InvokeError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"RequestTooLargeException" => crate::error::InvokeError {
meta: generic,
kind: crate::error::InvokeErrorKind::RequestTooLargeException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::request_too_large_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_request_too_large_exception_json_err(response.body().as_ref(), output).map_err(crate::error::InvokeError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"ResourceConflictException" => crate::error::InvokeError {
meta: generic,
kind: crate::error::InvokeErrorKind::ResourceConflictException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::resource_conflict_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_resource_conflict_exception_json_err(response.body().as_ref(), output).map_err(crate::error::InvokeError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"ResourceNotFoundException" => crate::error::InvokeError {
meta: generic,
kind: crate::error::InvokeErrorKind::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::InvokeError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"ResourceNotReadyException" => crate::error::InvokeError {
meta: generic,
kind: crate::error::InvokeErrorKind::ResourceNotReadyException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::resource_not_ready_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_resource_not_ready_exception_json_err(response.body().as_ref(), output).map_err(crate::error::InvokeError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"ServiceException" => {
crate::error::InvokeError {
meta: generic,
kind: crate::error::InvokeErrorKind::ServiceException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::service_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_service_exception_json_err(response.body().as_ref(), output).map_err(crate::error::InvokeError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
}
}
"SubnetIPAddressLimitReachedException" => {
crate::error::InvokeError {
meta: generic,
kind: crate::error::InvokeErrorKind::SubnetIpAddressLimitReachedException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]let mut output = crate::error::subnet_ip_address_limit_reached_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_subnet_ip_address_limit_reached_exception_json_err(response.body().as_ref(), output).map_err(crate::error::InvokeError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
}
}
"TooManyRequestsException" => crate::error::InvokeError {
meta: generic,
kind: crate::error::InvokeErrorKind::TooManyRequestsException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::too_many_requests_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_too_many_requests_exception_json_err(response.body().as_ref(), output).map_err(crate::error::InvokeError::unhandled)?;
output = output.set_retry_after_seconds(
crate::http_serde::deser_header_invoke_too_many_requests_exception_retry_after_seconds(response.headers())
.map_err(|_|crate::error::InvokeError::unhandled("Failed to parse retryAfterSeconds from header `Retry-After"))?
);
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"UnsupportedMediaTypeException" => crate::error::InvokeError {
meta: generic,
kind: crate::error::InvokeErrorKind::UnsupportedMediaTypeException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output =
crate::error::unsupported_media_type_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_unsupported_media_type_exception_json_err(response.body().as_ref(), output).map_err(crate::error::InvokeError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
_ => crate::error::InvokeError::generic(generic),
})
}
#[allow(clippy::unnecessary_wraps)]
pub fn parse_invoke_response(
response: &http::Response<bytes::Bytes>,
) -> std::result::Result<crate::output::InvokeOutput, crate::error::InvokeError> {
Ok({
#[allow(unused_mut)]
let mut output = crate::output::invoke_output::Builder::default();
let _ = response;
output = output.set_executed_version(
crate::http_serde::deser_header_invoke_invoke_output_executed_version(
response.headers(),
)
.map_err(|_| {
crate::error::InvokeError::unhandled(
"Failed to parse ExecutedVersion from header `X-Amz-Executed-Version",
)
})?,
);
output = output.set_function_error(
crate::http_serde::deser_header_invoke_invoke_output_function_error(response.headers())
.map_err(|_| {
crate::error::InvokeError::unhandled(
"Failed to parse FunctionError from header `X-Amz-Function-Error",
)
})?,
);
output = output.set_log_result(
crate::http_serde::deser_header_invoke_invoke_output_log_result(response.headers())
.map_err(|_| {
crate::error::InvokeError::unhandled(
"Failed to parse LogResult from header `X-Amz-Log-Result",
)
})?,
);
output = output.set_payload(
crate::http_serde::deser_payload_invoke_invoke_output_payload(
response.body().as_ref(),
)?,
);
output = output.set_status_code(Some(response.status().as_u16() as _));
output.build()
})
}
sourcepub fn generic(err: Error) -> Self
pub fn generic(err: Error) -> Self
Creates the InvokeError::Unhandled
variant from a aws_smithy_types::Error
.
Examples found in repository?
3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 3861 3862 3863 3864 3865 3866 3867 3868 3869 3870 3871 3872 3873 3874 3875 3876 3877 3878 3879 3880 3881 3882 3883 3884 3885 3886 3887 3888 3889 3890 3891 3892 3893 3894 3895 3896 3897 3898 3899 3900 3901 3902 3903 3904 3905 3906 3907 3908 3909 3910 3911 3912 3913 3914 3915 3916 3917 3918 3919 3920 3921 3922 3923 3924 3925 3926 3927 3928 3929 3930 3931 3932 3933 3934 3935 3936 3937 3938 3939 3940 3941 3942 3943 3944 3945 3946 3947 3948 3949 3950 3951 3952 3953 3954 3955 3956 3957 3958 3959 3960 3961 3962 3963 3964 3965 3966 3967 3968 3969 3970 3971 3972 3973 3974 3975 3976 3977 3978 3979 3980 3981 3982 3983 3984 3985 3986 3987 3988 3989 3990 3991 3992 3993 3994 3995 3996 3997 3998 3999 4000 4001 4002 4003 4004 4005 4006 4007 4008 4009 4010 4011 4012 4013 4014 4015 4016 4017 4018 4019 4020 4021 4022 4023 4024 4025 4026 4027 4028 4029 4030 4031 4032 4033 4034 4035 4036 4037 4038 4039 4040 4041 4042 4043 4044 4045 4046 4047 4048 4049 4050 4051 4052 4053 4054 4055 4056 4057 4058 4059 4060 4061 4062 4063 4064 4065 4066 4067 4068 4069 4070 4071 4072 4073 4074 4075 4076 4077 4078 4079 4080 4081 4082 4083 4084 4085 4086 4087 4088 4089 4090 4091 4092 4093 4094 4095 4096 4097 4098 4099 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 4120 4121 4122 4123 4124 4125 4126 4127 4128 4129 4130 4131 4132 4133 4134 4135 4136 4137 4138 4139 4140 4141 4142 4143 4144 4145 4146 4147 4148 4149 4150 4151 4152 4153 4154 4155 4156 4157 4158 4159 4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 4180 4181 4182 4183 4184 4185 4186 4187 4188 4189 4190 4191 4192 4193 4194 4195 4196 4197 4198 4199 4200 4201 4202 4203 4204 4205 4206 4207 4208 4209 4210 4211 4212 4213 4214 4215 4216 4217 4218 4219 4220 4221 4222 4223 4224 4225 4226 4227 4228 4229 4230 4231 4232 4233 4234 4235 4236 4237 4238 4239 4240 4241 4242 4243 4244 4245 4246 4247 4248 4249 4250 4251 4252 4253 4254 4255 4256 4257 4258 4259 4260 4261 4262 4263 4264 4265 4266 4267 4268 4269 4270 4271 4272 4273 4274 4275 4276 4277 4278 4279 4280 4281 4282 4283 4284 4285 4286 4287 4288 4289 4290 4291 4292 4293 4294 4295 4296 4297 4298 4299 4300 4301 4302
pub fn parse_invoke_error(
response: &http::Response<bytes::Bytes>,
) -> std::result::Result<crate::output::InvokeOutput, crate::error::InvokeError> {
let generic = crate::json_deser::parse_http_generic_error(response)
.map_err(crate::error::InvokeError::unhandled)?;
let error_code = match generic.code() {
Some(code) => code,
None => return Err(crate::error::InvokeError::unhandled(generic)),
};
let _error_message = generic.message().map(|msg| msg.to_owned());
Err(match error_code {
"EC2AccessDeniedException" => crate::error::InvokeError {
meta: generic,
kind: crate::error::InvokeErrorKind::Ec2AccessDeniedException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::ec2_access_denied_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_ec2_access_denied_exception_json_err(response.body().as_ref(), output).map_err(crate::error::InvokeError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"EC2ThrottledException" => crate::error::InvokeError {
meta: generic,
kind: crate::error::InvokeErrorKind::Ec2ThrottledException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::ec2_throttled_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_ec2_throttled_exception_json_err(response.body().as_ref(), output).map_err(crate::error::InvokeError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"EC2UnexpectedException" => crate::error::InvokeError {
meta: generic,
kind: crate::error::InvokeErrorKind::Ec2UnexpectedException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::ec2_unexpected_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_ec2_unexpected_exception_json_err(response.body().as_ref(), output).map_err(crate::error::InvokeError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"EFSIOException" => {
crate::error::InvokeError {
meta: generic,
kind: crate::error::InvokeErrorKind::EfsioException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::efsio_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_efsio_exception_json_err(response.body().as_ref(), output).map_err(crate::error::InvokeError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
}
}
"EFSMountConnectivityException" => crate::error::InvokeError {
meta: generic,
kind: crate::error::InvokeErrorKind::EfsMountConnectivityException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output =
crate::error::efs_mount_connectivity_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_efs_mount_connectivity_exception_json_err(response.body().as_ref(), output).map_err(crate::error::InvokeError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"EFSMountFailureException" => crate::error::InvokeError {
meta: generic,
kind: crate::error::InvokeErrorKind::EfsMountFailureException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::efs_mount_failure_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_efs_mount_failure_exception_json_err(response.body().as_ref(), output).map_err(crate::error::InvokeError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"EFSMountTimeoutException" => crate::error::InvokeError {
meta: generic,
kind: crate::error::InvokeErrorKind::EfsMountTimeoutException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::efs_mount_timeout_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_efs_mount_timeout_exception_json_err(response.body().as_ref(), output).map_err(crate::error::InvokeError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"ENILimitReachedException" => crate::error::InvokeError {
meta: generic,
kind: crate::error::InvokeErrorKind::EniLimitReachedException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::eni_limit_reached_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_eni_limit_reached_exception_json_err(response.body().as_ref(), output).map_err(crate::error::InvokeError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"InvalidParameterValueException" => crate::error::InvokeError {
meta: generic,
kind: crate::error::InvokeErrorKind::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::json_deser::deser_structure_crate_error_invalid_parameter_value_exception_json_err(response.body().as_ref(), output).map_err(crate::error::InvokeError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"InvalidRequestContentException" => crate::error::InvokeError {
meta: generic,
kind: crate::error::InvokeErrorKind::InvalidRequestContentException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output =
crate::error::invalid_request_content_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_invalid_request_content_exception_json_err(response.body().as_ref(), output).map_err(crate::error::InvokeError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"InvalidRuntimeException" => crate::error::InvokeError {
meta: generic,
kind: crate::error::InvokeErrorKind::InvalidRuntimeException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::invalid_runtime_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_invalid_runtime_exception_json_err(response.body().as_ref(), output).map_err(crate::error::InvokeError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"InvalidSecurityGroupIDException" => crate::error::InvokeError {
meta: generic,
kind: crate::error::InvokeErrorKind::InvalidSecurityGroupIdException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output =
crate::error::invalid_security_group_id_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_invalid_security_group_id_exception_json_err(response.body().as_ref(), output).map_err(crate::error::InvokeError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"InvalidSubnetIDException" => crate::error::InvokeError {
meta: generic,
kind: crate::error::InvokeErrorKind::InvalidSubnetIdException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::invalid_subnet_id_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_invalid_subnet_id_exception_json_err(response.body().as_ref(), output).map_err(crate::error::InvokeError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"InvalidZipFileException" => crate::error::InvokeError {
meta: generic,
kind: crate::error::InvokeErrorKind::InvalidZipFileException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::invalid_zip_file_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_invalid_zip_file_exception_json_err(response.body().as_ref(), output).map_err(crate::error::InvokeError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"KMSAccessDeniedException" => crate::error::InvokeError {
meta: generic,
kind: crate::error::InvokeErrorKind::KmsAccessDeniedException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::kms_access_denied_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_kms_access_denied_exception_json_err(response.body().as_ref(), output).map_err(crate::error::InvokeError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"KMSDisabledException" => crate::error::InvokeError {
meta: generic,
kind: crate::error::InvokeErrorKind::KmsDisabledException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::kms_disabled_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_kms_disabled_exception_json_err(response.body().as_ref(), output).map_err(crate::error::InvokeError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"KMSInvalidStateException" => crate::error::InvokeError {
meta: generic,
kind: crate::error::InvokeErrorKind::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::InvokeError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"KMSNotFoundException" => crate::error::InvokeError {
meta: generic,
kind: crate::error::InvokeErrorKind::KmsNotFoundException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::kms_not_found_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_kms_not_found_exception_json_err(response.body().as_ref(), output).map_err(crate::error::InvokeError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"RequestTooLargeException" => crate::error::InvokeError {
meta: generic,
kind: crate::error::InvokeErrorKind::RequestTooLargeException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::request_too_large_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_request_too_large_exception_json_err(response.body().as_ref(), output).map_err(crate::error::InvokeError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"ResourceConflictException" => crate::error::InvokeError {
meta: generic,
kind: crate::error::InvokeErrorKind::ResourceConflictException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::resource_conflict_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_resource_conflict_exception_json_err(response.body().as_ref(), output).map_err(crate::error::InvokeError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"ResourceNotFoundException" => crate::error::InvokeError {
meta: generic,
kind: crate::error::InvokeErrorKind::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::InvokeError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"ResourceNotReadyException" => crate::error::InvokeError {
meta: generic,
kind: crate::error::InvokeErrorKind::ResourceNotReadyException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::resource_not_ready_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_resource_not_ready_exception_json_err(response.body().as_ref(), output).map_err(crate::error::InvokeError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"ServiceException" => {
crate::error::InvokeError {
meta: generic,
kind: crate::error::InvokeErrorKind::ServiceException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::service_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_service_exception_json_err(response.body().as_ref(), output).map_err(crate::error::InvokeError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
}
}
"SubnetIPAddressLimitReachedException" => {
crate::error::InvokeError {
meta: generic,
kind: crate::error::InvokeErrorKind::SubnetIpAddressLimitReachedException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]let mut output = crate::error::subnet_ip_address_limit_reached_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_subnet_ip_address_limit_reached_exception_json_err(response.body().as_ref(), output).map_err(crate::error::InvokeError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
}
}
"TooManyRequestsException" => crate::error::InvokeError {
meta: generic,
kind: crate::error::InvokeErrorKind::TooManyRequestsException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::too_many_requests_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_too_many_requests_exception_json_err(response.body().as_ref(), output).map_err(crate::error::InvokeError::unhandled)?;
output = output.set_retry_after_seconds(
crate::http_serde::deser_header_invoke_too_many_requests_exception_retry_after_seconds(response.headers())
.map_err(|_|crate::error::InvokeError::unhandled("Failed to parse retryAfterSeconds from header `Retry-After"))?
);
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"UnsupportedMediaTypeException" => crate::error::InvokeError {
meta: generic,
kind: crate::error::InvokeErrorKind::UnsupportedMediaTypeException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output =
crate::error::unsupported_media_type_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_unsupported_media_type_exception_json_err(response.body().as_ref(), output).map_err(crate::error::InvokeError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
_ => crate::error::InvokeError::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_ec2_access_denied_exception(&self) -> bool
pub fn is_ec2_access_denied_exception(&self) -> bool
Returns true
if the error kind is InvokeErrorKind::Ec2AccessDeniedException
.
sourcepub fn is_ec2_throttled_exception(&self) -> bool
pub fn is_ec2_throttled_exception(&self) -> bool
Returns true
if the error kind is InvokeErrorKind::Ec2ThrottledException
.
sourcepub fn is_ec2_unexpected_exception(&self) -> bool
pub fn is_ec2_unexpected_exception(&self) -> bool
Returns true
if the error kind is InvokeErrorKind::Ec2UnexpectedException
.
sourcepub fn is_efsio_exception(&self) -> bool
pub fn is_efsio_exception(&self) -> bool
Returns true
if the error kind is InvokeErrorKind::EfsioException
.
sourcepub fn is_efs_mount_connectivity_exception(&self) -> bool
pub fn is_efs_mount_connectivity_exception(&self) -> bool
Returns true
if the error kind is InvokeErrorKind::EfsMountConnectivityException
.
sourcepub fn is_efs_mount_failure_exception(&self) -> bool
pub fn is_efs_mount_failure_exception(&self) -> bool
Returns true
if the error kind is InvokeErrorKind::EfsMountFailureException
.
sourcepub fn is_efs_mount_timeout_exception(&self) -> bool
pub fn is_efs_mount_timeout_exception(&self) -> bool
Returns true
if the error kind is InvokeErrorKind::EfsMountTimeoutException
.
sourcepub fn is_eni_limit_reached_exception(&self) -> bool
pub fn is_eni_limit_reached_exception(&self) -> bool
Returns true
if the error kind is InvokeErrorKind::EniLimitReachedException
.
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 InvokeErrorKind::InvalidParameterValueException
.
sourcepub fn is_invalid_request_content_exception(&self) -> bool
pub fn is_invalid_request_content_exception(&self) -> bool
Returns true
if the error kind is InvokeErrorKind::InvalidRequestContentException
.
sourcepub fn is_invalid_runtime_exception(&self) -> bool
pub fn is_invalid_runtime_exception(&self) -> bool
Returns true
if the error kind is InvokeErrorKind::InvalidRuntimeException
.
sourcepub fn is_invalid_security_group_id_exception(&self) -> bool
pub fn is_invalid_security_group_id_exception(&self) -> bool
Returns true
if the error kind is InvokeErrorKind::InvalidSecurityGroupIdException
.
sourcepub fn is_invalid_subnet_id_exception(&self) -> bool
pub fn is_invalid_subnet_id_exception(&self) -> bool
Returns true
if the error kind is InvokeErrorKind::InvalidSubnetIdException
.
sourcepub fn is_invalid_zip_file_exception(&self) -> bool
pub fn is_invalid_zip_file_exception(&self) -> bool
Returns true
if the error kind is InvokeErrorKind::InvalidZipFileException
.
sourcepub fn is_kms_access_denied_exception(&self) -> bool
pub fn is_kms_access_denied_exception(&self) -> bool
Returns true
if the error kind is InvokeErrorKind::KmsAccessDeniedException
.
sourcepub fn is_kms_disabled_exception(&self) -> bool
pub fn is_kms_disabled_exception(&self) -> bool
Returns true
if the error kind is InvokeErrorKind::KmsDisabledException
.
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 InvokeErrorKind::KmsInvalidStateException
.
sourcepub fn is_kms_not_found_exception(&self) -> bool
pub fn is_kms_not_found_exception(&self) -> bool
Returns true
if the error kind is InvokeErrorKind::KmsNotFoundException
.
sourcepub fn is_request_too_large_exception(&self) -> bool
pub fn is_request_too_large_exception(&self) -> bool
Returns true
if the error kind is InvokeErrorKind::RequestTooLargeException
.
sourcepub fn is_resource_conflict_exception(&self) -> bool
pub fn is_resource_conflict_exception(&self) -> bool
Returns true
if the error kind is InvokeErrorKind::ResourceConflictException
.
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 InvokeErrorKind::ResourceNotFoundException
.
sourcepub fn is_resource_not_ready_exception(&self) -> bool
pub fn is_resource_not_ready_exception(&self) -> bool
Returns true
if the error kind is InvokeErrorKind::ResourceNotReadyException
.
sourcepub fn is_service_exception(&self) -> bool
pub fn is_service_exception(&self) -> bool
Returns true
if the error kind is InvokeErrorKind::ServiceException
.
sourcepub fn is_subnet_ip_address_limit_reached_exception(&self) -> bool
pub fn is_subnet_ip_address_limit_reached_exception(&self) -> bool
Returns true
if the error kind is InvokeErrorKind::SubnetIpAddressLimitReachedException
.
sourcepub fn is_too_many_requests_exception(&self) -> bool
pub fn is_too_many_requests_exception(&self) -> bool
Returns true
if the error kind is InvokeErrorKind::TooManyRequestsException
.
sourcepub fn is_unsupported_media_type_exception(&self) -> bool
pub fn is_unsupported_media_type_exception(&self) -> bool
Returns true
if the error kind is InvokeErrorKind::UnsupportedMediaTypeException
.