Struct aws_sdk_lambda::error::ListLayersError
source · #[non_exhaustive]pub struct ListLayersError {
pub kind: ListLayersErrorKind,
/* private fields */
}
Expand description
Error type for the ListLayers
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: ListLayersErrorKind
Kind of error that occurred.
Implementations§
source§impl ListLayersError
impl ListLayersError
sourcepub fn new(kind: ListLayersErrorKind, meta: Error) -> Self
pub fn new(kind: ListLayersErrorKind, meta: Error) -> Self
Creates a new ListLayersError
.
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 ListLayersError::Unhandled
variant from any error type.
Examples found in repository?
src/operation_deser.rs (line 5177)
5170 5171 5172 5173 5174 5175 5176 5177 5178 5179 5180 5181 5182 5183 5184 5185 5186 5187 5188 5189 5190 5191 5192 5193 5194 5195 5196 5197 5198 5199 5200 5201 5202 5203 5204 5205 5206 5207 5208 5209 5210 5211 5212 5213 5214 5215 5216 5217 5218 5219 5220 5221 5222 5223 5224 5225 5226 5227 5228 5229 5230 5231 5232 5233 5234 5235 5236 5237 5238 5239 5240 5241 5242
pub fn parse_list_layers_error(
response: &http::Response<bytes::Bytes>,
) -> std::result::Result<crate::output::ListLayersOutput, crate::error::ListLayersError> {
let generic = crate::json_deser::parse_http_generic_error(response)
.map_err(crate::error::ListLayersError::unhandled)?;
let error_code = match generic.code() {
Some(code) => code,
None => return Err(crate::error::ListLayersError::unhandled(generic)),
};
let _error_message = generic.message().map(|msg| msg.to_owned());
Err(match error_code {
"InvalidParameterValueException" => crate::error::ListLayersError {
meta: generic,
kind: crate::error::ListLayersErrorKind::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::ListLayersError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"ServiceException" => {
crate::error::ListLayersError {
meta: generic,
kind: crate::error::ListLayersErrorKind::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::ListLayersError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
}
}
"TooManyRequestsException" => crate::error::ListLayersError {
meta: generic,
kind: crate::error::ListLayersErrorKind::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::ListLayersError::unhandled)?;
output = output.set_retry_after_seconds(
crate::http_serde::deser_header_list_layers_too_many_requests_exception_retry_after_seconds(response.headers())
.map_err(|_|crate::error::ListLayersError::unhandled("Failed to parse retryAfterSeconds from header `Retry-After"))?
);
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
_ => crate::error::ListLayersError::generic(generic),
})
}
sourcepub fn generic(err: Error) -> Self
pub fn generic(err: Error) -> Self
Creates the ListLayersError::Unhandled
variant from a aws_smithy_types::Error
.
Examples found in repository?
src/operation_deser.rs (line 5240)
5170 5171 5172 5173 5174 5175 5176 5177 5178 5179 5180 5181 5182 5183 5184 5185 5186 5187 5188 5189 5190 5191 5192 5193 5194 5195 5196 5197 5198 5199 5200 5201 5202 5203 5204 5205 5206 5207 5208 5209 5210 5211 5212 5213 5214 5215 5216 5217 5218 5219 5220 5221 5222 5223 5224 5225 5226 5227 5228 5229 5230 5231 5232 5233 5234 5235 5236 5237 5238 5239 5240 5241 5242
pub fn parse_list_layers_error(
response: &http::Response<bytes::Bytes>,
) -> std::result::Result<crate::output::ListLayersOutput, crate::error::ListLayersError> {
let generic = crate::json_deser::parse_http_generic_error(response)
.map_err(crate::error::ListLayersError::unhandled)?;
let error_code = match generic.code() {
Some(code) => code,
None => return Err(crate::error::ListLayersError::unhandled(generic)),
};
let _error_message = generic.message().map(|msg| msg.to_owned());
Err(match error_code {
"InvalidParameterValueException" => crate::error::ListLayersError {
meta: generic,
kind: crate::error::ListLayersErrorKind::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::ListLayersError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"ServiceException" => {
crate::error::ListLayersError {
meta: generic,
kind: crate::error::ListLayersErrorKind::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::ListLayersError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
}
}
"TooManyRequestsException" => crate::error::ListLayersError {
meta: generic,
kind: crate::error::ListLayersErrorKind::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::ListLayersError::unhandled)?;
output = output.set_retry_after_seconds(
crate::http_serde::deser_header_list_layers_too_many_requests_exception_retry_after_seconds(response.headers())
.map_err(|_|crate::error::ListLayersError::unhandled("Failed to parse retryAfterSeconds from header `Retry-After"))?
);
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
_ => crate::error::ListLayersError::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_invalid_parameter_value_exception(&self) -> bool
pub fn is_invalid_parameter_value_exception(&self) -> bool
Returns true
if the error kind is ListLayersErrorKind::InvalidParameterValueException
.
sourcepub fn is_service_exception(&self) -> bool
pub fn is_service_exception(&self) -> bool
Returns true
if the error kind is ListLayersErrorKind::ServiceException
.
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 ListLayersErrorKind::TooManyRequestsException
.
Trait Implementations§
source§impl Debug for ListLayersError
impl Debug for ListLayersError
source§impl Display for ListLayersError
impl Display for ListLayersError
source§impl Error for ListLayersError
impl Error for ListLayersError
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<ListLayersError> for Error
impl From<ListLayersError> for Error
source§fn from(err: ListLayersError) -> Self
fn from(err: ListLayersError) -> Self
Converts to this type from the input type.