Struct aws_sdk_mediapackage::error::CreateHarvestJobError
source · #[non_exhaustive]pub struct CreateHarvestJobError {
pub kind: CreateHarvestJobErrorKind,
/* private fields */
}
Expand description
Error type for the CreateHarvestJob
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: CreateHarvestJobErrorKind
Kind of error that occurred.
Implementations§
source§impl CreateHarvestJobError
impl CreateHarvestJobError
sourcepub fn new(kind: CreateHarvestJobErrorKind, meta: Error) -> Self
pub fn new(kind: CreateHarvestJobErrorKind, meta: Error) -> Self
Creates a new CreateHarvestJobError
.
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 CreateHarvestJobError::Unhandled
variant from any error type.
Examples found in repository?
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 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401
pub fn parse_create_harvest_job_error(
response: &http::Response<bytes::Bytes>,
) -> std::result::Result<crate::output::CreateHarvestJobOutput, crate::error::CreateHarvestJobError>
{
let generic = crate::json_deser::parse_http_generic_error(response)
.map_err(crate::error::CreateHarvestJobError::unhandled)?;
let error_code = match generic.code() {
Some(code) => code,
None => return Err(crate::error::CreateHarvestJobError::unhandled(generic)),
};
let _error_message = generic.message().map(|msg| msg.to_owned());
Err(match error_code {
"ForbiddenException" => crate::error::CreateHarvestJobError {
meta: generic,
kind: crate::error::CreateHarvestJobErrorKind::ForbiddenException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::forbidden_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_forbidden_exception_json_err(response.body().as_ref(), output).map_err(crate::error::CreateHarvestJobError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"InternalServerErrorException" => crate::error::CreateHarvestJobError {
meta: generic,
kind: crate::error::CreateHarvestJobErrorKind::InternalServerErrorException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output =
crate::error::internal_server_error_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_internal_server_error_exception_json_err(response.body().as_ref(), output).map_err(crate::error::CreateHarvestJobError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"NotFoundException" => crate::error::CreateHarvestJobError {
meta: generic,
kind: crate::error::CreateHarvestJobErrorKind::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::CreateHarvestJobError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"ServiceUnavailableException" => crate::error::CreateHarvestJobError {
meta: generic,
kind: crate::error::CreateHarvestJobErrorKind::ServiceUnavailableException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output =
crate::error::service_unavailable_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_service_unavailable_exception_json_err(response.body().as_ref(), output).map_err(crate::error::CreateHarvestJobError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"TooManyRequestsException" => crate::error::CreateHarvestJobError {
meta: generic,
kind: crate::error::CreateHarvestJobErrorKind::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::CreateHarvestJobError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"UnprocessableEntityException" => crate::error::CreateHarvestJobError {
meta: generic,
kind: crate::error::CreateHarvestJobErrorKind::UnprocessableEntityException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output =
crate::error::unprocessable_entity_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_unprocessable_entity_exception_json_err(response.body().as_ref(), output).map_err(crate::error::CreateHarvestJobError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
_ => crate::error::CreateHarvestJobError::generic(generic),
})
}
sourcepub fn generic(err: Error) -> Self
pub fn generic(err: Error) -> Self
Creates the CreateHarvestJobError::Unhandled
variant from a aws_smithy_types::Error
.
Examples found in repository?
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 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401
pub fn parse_create_harvest_job_error(
response: &http::Response<bytes::Bytes>,
) -> std::result::Result<crate::output::CreateHarvestJobOutput, crate::error::CreateHarvestJobError>
{
let generic = crate::json_deser::parse_http_generic_error(response)
.map_err(crate::error::CreateHarvestJobError::unhandled)?;
let error_code = match generic.code() {
Some(code) => code,
None => return Err(crate::error::CreateHarvestJobError::unhandled(generic)),
};
let _error_message = generic.message().map(|msg| msg.to_owned());
Err(match error_code {
"ForbiddenException" => crate::error::CreateHarvestJobError {
meta: generic,
kind: crate::error::CreateHarvestJobErrorKind::ForbiddenException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::forbidden_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_forbidden_exception_json_err(response.body().as_ref(), output).map_err(crate::error::CreateHarvestJobError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"InternalServerErrorException" => crate::error::CreateHarvestJobError {
meta: generic,
kind: crate::error::CreateHarvestJobErrorKind::InternalServerErrorException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output =
crate::error::internal_server_error_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_internal_server_error_exception_json_err(response.body().as_ref(), output).map_err(crate::error::CreateHarvestJobError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"NotFoundException" => crate::error::CreateHarvestJobError {
meta: generic,
kind: crate::error::CreateHarvestJobErrorKind::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::CreateHarvestJobError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"ServiceUnavailableException" => crate::error::CreateHarvestJobError {
meta: generic,
kind: crate::error::CreateHarvestJobErrorKind::ServiceUnavailableException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output =
crate::error::service_unavailable_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_service_unavailable_exception_json_err(response.body().as_ref(), output).map_err(crate::error::CreateHarvestJobError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"TooManyRequestsException" => crate::error::CreateHarvestJobError {
meta: generic,
kind: crate::error::CreateHarvestJobErrorKind::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::CreateHarvestJobError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"UnprocessableEntityException" => crate::error::CreateHarvestJobError {
meta: generic,
kind: crate::error::CreateHarvestJobErrorKind::UnprocessableEntityException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output =
crate::error::unprocessable_entity_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_unprocessable_entity_exception_json_err(response.body().as_ref(), output).map_err(crate::error::CreateHarvestJobError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
_ => crate::error::CreateHarvestJobError::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_forbidden_exception(&self) -> bool
pub fn is_forbidden_exception(&self) -> bool
Returns true
if the error kind is CreateHarvestJobErrorKind::ForbiddenException
.
sourcepub fn is_internal_server_error_exception(&self) -> bool
pub fn is_internal_server_error_exception(&self) -> bool
Returns true
if the error kind is CreateHarvestJobErrorKind::InternalServerErrorException
.
sourcepub fn is_not_found_exception(&self) -> bool
pub fn is_not_found_exception(&self) -> bool
Returns true
if the error kind is CreateHarvestJobErrorKind::NotFoundException
.
Returns true
if the error kind is CreateHarvestJobErrorKind::ServiceUnavailableException
.
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 CreateHarvestJobErrorKind::TooManyRequestsException
.
sourcepub fn is_unprocessable_entity_exception(&self) -> bool
pub fn is_unprocessable_entity_exception(&self) -> bool
Returns true
if the error kind is CreateHarvestJobErrorKind::UnprocessableEntityException
.