Struct aws_sdk_ssm::error::GetParameterError
source · #[non_exhaustive]pub struct GetParameterError {
pub kind: GetParameterErrorKind,
/* private fields */
}
Expand description
Error type for the GetParameter
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: GetParameterErrorKind
Kind of error that occurred.
Implementations§
source§impl GetParameterError
impl GetParameterError
sourcepub fn new(kind: GetParameterErrorKind, meta: Error) -> Self
pub fn new(kind: GetParameterErrorKind, meta: Error) -> Self
Creates a new GetParameterError
.
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 GetParameterError::Unhandled
variant from any error type.
Examples found in repository?
src/operation_deser.rs (line 7297)
7290 7291 7292 7293 7294 7295 7296 7297 7298 7299 7300 7301 7302 7303 7304 7305 7306 7307 7308 7309 7310 7311 7312 7313 7314 7315 7316 7317 7318 7319 7320 7321 7322 7323 7324 7325 7326 7327 7328 7329 7330 7331 7332 7333 7334 7335 7336 7337 7338 7339 7340 7341 7342 7343 7344 7345 7346 7347 7348 7349 7350 7351 7352 7353 7354 7355 7356 7357 7358 7359 7360 7361 7362 7363 7364 7365 7366 7367 7368 7369 7370 7371 7372 7373 7374 7375 7376 7377
pub fn parse_get_parameter_error(
response: &http::Response<bytes::Bytes>,
) -> std::result::Result<crate::output::GetParameterOutput, crate::error::GetParameterError> {
let generic = crate::json_deser::parse_http_generic_error(response)
.map_err(crate::error::GetParameterError::unhandled)?;
let error_code = match generic.code() {
Some(code) => code,
None => return Err(crate::error::GetParameterError::unhandled(generic)),
};
let _error_message = generic.message().map(|msg| msg.to_owned());
Err(match error_code {
"InternalServerError" => crate::error::GetParameterError {
meta: generic,
kind: crate::error::GetParameterErrorKind::InternalServerError({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::internal_server_error::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_internal_server_error_json_err(response.body().as_ref(), output).map_err(crate::error::GetParameterError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"InvalidKeyId" => crate::error::GetParameterError {
meta: generic,
kind: crate::error::GetParameterErrorKind::InvalidKeyId({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::invalid_key_id::Builder::default();
let _ = response;
output =
crate::json_deser::deser_structure_crate_error_invalid_key_id_json_err(
response.body().as_ref(),
output,
)
.map_err(crate::error::GetParameterError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"ParameterNotFound" => crate::error::GetParameterError {
meta: generic,
kind: crate::error::GetParameterErrorKind::ParameterNotFound({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::parameter_not_found::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_parameter_not_found_json_err(response.body().as_ref(), output).map_err(crate::error::GetParameterError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"ParameterVersionNotFound" => crate::error::GetParameterError {
meta: generic,
kind: crate::error::GetParameterErrorKind::ParameterVersionNotFound({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::parameter_version_not_found::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_parameter_version_not_found_json_err(response.body().as_ref(), output).map_err(crate::error::GetParameterError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
_ => crate::error::GetParameterError::generic(generic),
})
}
sourcepub fn generic(err: Error) -> Self
pub fn generic(err: Error) -> Self
Creates the GetParameterError::Unhandled
variant from a aws_smithy_types::Error
.
Examples found in repository?
src/operation_deser.rs (line 7375)
7290 7291 7292 7293 7294 7295 7296 7297 7298 7299 7300 7301 7302 7303 7304 7305 7306 7307 7308 7309 7310 7311 7312 7313 7314 7315 7316 7317 7318 7319 7320 7321 7322 7323 7324 7325 7326 7327 7328 7329 7330 7331 7332 7333 7334 7335 7336 7337 7338 7339 7340 7341 7342 7343 7344 7345 7346 7347 7348 7349 7350 7351 7352 7353 7354 7355 7356 7357 7358 7359 7360 7361 7362 7363 7364 7365 7366 7367 7368 7369 7370 7371 7372 7373 7374 7375 7376 7377
pub fn parse_get_parameter_error(
response: &http::Response<bytes::Bytes>,
) -> std::result::Result<crate::output::GetParameterOutput, crate::error::GetParameterError> {
let generic = crate::json_deser::parse_http_generic_error(response)
.map_err(crate::error::GetParameterError::unhandled)?;
let error_code = match generic.code() {
Some(code) => code,
None => return Err(crate::error::GetParameterError::unhandled(generic)),
};
let _error_message = generic.message().map(|msg| msg.to_owned());
Err(match error_code {
"InternalServerError" => crate::error::GetParameterError {
meta: generic,
kind: crate::error::GetParameterErrorKind::InternalServerError({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::internal_server_error::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_internal_server_error_json_err(response.body().as_ref(), output).map_err(crate::error::GetParameterError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"InvalidKeyId" => crate::error::GetParameterError {
meta: generic,
kind: crate::error::GetParameterErrorKind::InvalidKeyId({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::invalid_key_id::Builder::default();
let _ = response;
output =
crate::json_deser::deser_structure_crate_error_invalid_key_id_json_err(
response.body().as_ref(),
output,
)
.map_err(crate::error::GetParameterError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"ParameterNotFound" => crate::error::GetParameterError {
meta: generic,
kind: crate::error::GetParameterErrorKind::ParameterNotFound({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::parameter_not_found::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_parameter_not_found_json_err(response.body().as_ref(), output).map_err(crate::error::GetParameterError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"ParameterVersionNotFound" => crate::error::GetParameterError {
meta: generic,
kind: crate::error::GetParameterErrorKind::ParameterVersionNotFound({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::parameter_version_not_found::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_parameter_version_not_found_json_err(response.body().as_ref(), output).map_err(crate::error::GetParameterError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
_ => crate::error::GetParameterError::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_error(&self) -> bool
pub fn is_internal_server_error(&self) -> bool
Returns true
if the error kind is GetParameterErrorKind::InternalServerError
.
sourcepub fn is_invalid_key_id(&self) -> bool
pub fn is_invalid_key_id(&self) -> bool
Returns true
if the error kind is GetParameterErrorKind::InvalidKeyId
.
sourcepub fn is_parameter_not_found(&self) -> bool
pub fn is_parameter_not_found(&self) -> bool
Returns true
if the error kind is GetParameterErrorKind::ParameterNotFound
.
sourcepub fn is_parameter_version_not_found(&self) -> bool
pub fn is_parameter_version_not_found(&self) -> bool
Returns true
if the error kind is GetParameterErrorKind::ParameterVersionNotFound
.
Trait Implementations§
source§impl Debug for GetParameterError
impl Debug for GetParameterError
source§impl Display for GetParameterError
impl Display for GetParameterError
source§impl Error for GetParameterError
impl Error for GetParameterError
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<GetParameterError> for Error
impl From<GetParameterError> for Error
source§fn from(err: GetParameterError) -> Self
fn from(err: GetParameterError) -> Self
Converts to this type from the input type.