#[non_exhaustive]pub struct GetRecordError {
pub kind: GetRecordErrorKind,
/* private fields */
}
Expand description
Error type for the GetRecord
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: GetRecordErrorKind
Kind of error that occurred.
Implementations§
source§impl GetRecordError
impl GetRecordError
sourcepub fn new(kind: GetRecordErrorKind, meta: Error) -> Self
pub fn new(kind: GetRecordErrorKind, meta: Error) -> Self
Creates a new GetRecordError
.
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 GetRecordError::Unhandled
variant from any error type.
Examples found in repository?
src/operation_deser.rs (line 221)
214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321
pub fn parse_get_record_error(
response: &http::Response<bytes::Bytes>,
) -> std::result::Result<crate::output::GetRecordOutput, crate::error::GetRecordError> {
let generic = crate::json_deser::parse_http_generic_error(response)
.map_err(crate::error::GetRecordError::unhandled)?;
let error_code = match generic.code() {
Some(code) => code,
None => return Err(crate::error::GetRecordError::unhandled(generic)),
};
let _error_message = generic.message().map(|msg| msg.to_owned());
Err(match error_code {
"AccessForbidden" => {
crate::error::GetRecordError {
meta: generic,
kind: crate::error::GetRecordErrorKind::AccessForbidden({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::access_forbidden::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_access_forbidden_json_err(response.body().as_ref(), output).map_err(crate::error::GetRecordError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
}
}
"InternalFailure" => {
crate::error::GetRecordError {
meta: generic,
kind: crate::error::GetRecordErrorKind::InternalFailure({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::internal_failure::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_internal_failure_json_err(response.body().as_ref(), output).map_err(crate::error::GetRecordError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
}
}
"ResourceNotFound" => {
crate::error::GetRecordError {
meta: generic,
kind: crate::error::GetRecordErrorKind::ResourceNotFound({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::resource_not_found::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_resource_not_found_json_err(response.body().as_ref(), output).map_err(crate::error::GetRecordError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
}
}
"ServiceUnavailable" => crate::error::GetRecordError {
meta: generic,
kind: crate::error::GetRecordErrorKind::ServiceUnavailable({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::service_unavailable::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_service_unavailable_json_err(response.body().as_ref(), output).map_err(crate::error::GetRecordError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"ValidationError" => {
crate::error::GetRecordError {
meta: generic,
kind: crate::error::GetRecordErrorKind::ValidationError({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::validation_error::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_validation_error_json_err(response.body().as_ref(), output).map_err(crate::error::GetRecordError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
}
}
_ => crate::error::GetRecordError::generic(generic),
})
}
sourcepub fn generic(err: Error) -> Self
pub fn generic(err: Error) -> Self
Creates the GetRecordError::Unhandled
variant from a aws_smithy_types::Error
.
Examples found in repository?
src/operation_deser.rs (line 319)
214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321
pub fn parse_get_record_error(
response: &http::Response<bytes::Bytes>,
) -> std::result::Result<crate::output::GetRecordOutput, crate::error::GetRecordError> {
let generic = crate::json_deser::parse_http_generic_error(response)
.map_err(crate::error::GetRecordError::unhandled)?;
let error_code = match generic.code() {
Some(code) => code,
None => return Err(crate::error::GetRecordError::unhandled(generic)),
};
let _error_message = generic.message().map(|msg| msg.to_owned());
Err(match error_code {
"AccessForbidden" => {
crate::error::GetRecordError {
meta: generic,
kind: crate::error::GetRecordErrorKind::AccessForbidden({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::access_forbidden::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_access_forbidden_json_err(response.body().as_ref(), output).map_err(crate::error::GetRecordError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
}
}
"InternalFailure" => {
crate::error::GetRecordError {
meta: generic,
kind: crate::error::GetRecordErrorKind::InternalFailure({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::internal_failure::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_internal_failure_json_err(response.body().as_ref(), output).map_err(crate::error::GetRecordError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
}
}
"ResourceNotFound" => {
crate::error::GetRecordError {
meta: generic,
kind: crate::error::GetRecordErrorKind::ResourceNotFound({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::resource_not_found::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_resource_not_found_json_err(response.body().as_ref(), output).map_err(crate::error::GetRecordError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
}
}
"ServiceUnavailable" => crate::error::GetRecordError {
meta: generic,
kind: crate::error::GetRecordErrorKind::ServiceUnavailable({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::service_unavailable::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_service_unavailable_json_err(response.body().as_ref(), output).map_err(crate::error::GetRecordError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"ValidationError" => {
crate::error::GetRecordError {
meta: generic,
kind: crate::error::GetRecordErrorKind::ValidationError({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::validation_error::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_validation_error_json_err(response.body().as_ref(), output).map_err(crate::error::GetRecordError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
}
}
_ => crate::error::GetRecordError::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_access_forbidden(&self) -> bool
pub fn is_access_forbidden(&self) -> bool
Returns true
if the error kind is GetRecordErrorKind::AccessForbidden
.
sourcepub fn is_internal_failure(&self) -> bool
pub fn is_internal_failure(&self) -> bool
Returns true
if the error kind is GetRecordErrorKind::InternalFailure
.
sourcepub fn is_resource_not_found(&self) -> bool
pub fn is_resource_not_found(&self) -> bool
Returns true
if the error kind is GetRecordErrorKind::ResourceNotFound
.
Returns true
if the error kind is GetRecordErrorKind::ServiceUnavailable
.
sourcepub fn is_validation_error(&self) -> bool
pub fn is_validation_error(&self) -> bool
Returns true
if the error kind is GetRecordErrorKind::ValidationError
.
Trait Implementations§
source§impl Debug for GetRecordError
impl Debug for GetRecordError
source§impl Display for GetRecordError
impl Display for GetRecordError
source§impl Error for GetRecordError
impl Error for GetRecordError
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<GetRecordError> for Error
impl From<GetRecordError> for Error
source§fn from(err: GetRecordError) -> Self
fn from(err: GetRecordError) -> Self
Converts to this type from the input type.