Struct aws_sdk_workdocs::error::CreateCommentError
source · #[non_exhaustive]pub struct CreateCommentError {
pub kind: CreateCommentErrorKind,
/* private fields */
}
Expand description
Error type for the CreateComment
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: CreateCommentErrorKind
Kind of error that occurred.
Implementations§
source§impl CreateCommentError
impl CreateCommentError
sourcepub fn new(kind: CreateCommentErrorKind, meta: Error) -> Self
pub fn new(kind: CreateCommentErrorKind, meta: Error) -> Self
Creates a new CreateCommentError
.
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 CreateCommentError::Unhandled
variant from any error type.
Examples found in repository?
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 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519
pub fn parse_create_comment_error(
response: &http::Response<bytes::Bytes>,
) -> std::result::Result<crate::output::CreateCommentOutput, crate::error::CreateCommentError> {
let generic = crate::json_deser::parse_http_generic_error(response)
.map_err(crate::error::CreateCommentError::unhandled)?;
let error_code = match generic.code() {
Some(code) => code,
None => return Err(crate::error::CreateCommentError::unhandled(generic)),
};
let _error_message = generic.message().map(|msg| msg.to_owned());
Err(match error_code {
"DocumentLockedForCommentsException" => crate::error::CreateCommentError {
meta: generic,
kind: crate::error::CreateCommentErrorKind::DocumentLockedForCommentsException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output =
crate::error::document_locked_for_comments_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_document_locked_for_comments_exception_json_err(response.body().as_ref(), output).map_err(crate::error::CreateCommentError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"EntityNotExistsException" => crate::error::CreateCommentError {
meta: generic,
kind: crate::error::CreateCommentErrorKind::EntityNotExistsException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::entity_not_exists_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_entity_not_exists_exception_json_err(response.body().as_ref(), output).map_err(crate::error::CreateCommentError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"FailedDependencyException" => crate::error::CreateCommentError {
meta: generic,
kind: crate::error::CreateCommentErrorKind::FailedDependencyException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::failed_dependency_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_failed_dependency_exception_json_err(response.body().as_ref(), output).map_err(crate::error::CreateCommentError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"InvalidCommentOperationException" => crate::error::CreateCommentError {
meta: generic,
kind: crate::error::CreateCommentErrorKind::InvalidCommentOperationException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output =
crate::error::invalid_comment_operation_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_invalid_comment_operation_exception_json_err(response.body().as_ref(), output).map_err(crate::error::CreateCommentError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"ProhibitedStateException" => crate::error::CreateCommentError {
meta: generic,
kind: crate::error::CreateCommentErrorKind::ProhibitedStateException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::prohibited_state_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_prohibited_state_exception_json_err(response.body().as_ref(), output).map_err(crate::error::CreateCommentError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"ServiceUnavailableException" => crate::error::CreateCommentError {
meta: generic,
kind: crate::error::CreateCommentErrorKind::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::CreateCommentError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"UnauthorizedOperationException" => crate::error::CreateCommentError {
meta: generic,
kind: crate::error::CreateCommentErrorKind::UnauthorizedOperationException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output =
crate::error::unauthorized_operation_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_unauthorized_operation_exception_json_err(response.body().as_ref(), output).map_err(crate::error::CreateCommentError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"UnauthorizedResourceAccessException" => crate::error::CreateCommentError {
meta: generic,
kind: crate::error::CreateCommentErrorKind::UnauthorizedResourceAccessException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output =
crate::error::unauthorized_resource_access_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_unauthorized_resource_access_exception_json_err(response.body().as_ref(), output).map_err(crate::error::CreateCommentError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
_ => crate::error::CreateCommentError::generic(generic),
})
}
sourcepub fn generic(err: Error) -> Self
pub fn generic(err: Error) -> Self
Creates the CreateCommentError::Unhandled
variant from a aws_smithy_types::Error
.
Examples found in repository?
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 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519
pub fn parse_create_comment_error(
response: &http::Response<bytes::Bytes>,
) -> std::result::Result<crate::output::CreateCommentOutput, crate::error::CreateCommentError> {
let generic = crate::json_deser::parse_http_generic_error(response)
.map_err(crate::error::CreateCommentError::unhandled)?;
let error_code = match generic.code() {
Some(code) => code,
None => return Err(crate::error::CreateCommentError::unhandled(generic)),
};
let _error_message = generic.message().map(|msg| msg.to_owned());
Err(match error_code {
"DocumentLockedForCommentsException" => crate::error::CreateCommentError {
meta: generic,
kind: crate::error::CreateCommentErrorKind::DocumentLockedForCommentsException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output =
crate::error::document_locked_for_comments_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_document_locked_for_comments_exception_json_err(response.body().as_ref(), output).map_err(crate::error::CreateCommentError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"EntityNotExistsException" => crate::error::CreateCommentError {
meta: generic,
kind: crate::error::CreateCommentErrorKind::EntityNotExistsException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::entity_not_exists_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_entity_not_exists_exception_json_err(response.body().as_ref(), output).map_err(crate::error::CreateCommentError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"FailedDependencyException" => crate::error::CreateCommentError {
meta: generic,
kind: crate::error::CreateCommentErrorKind::FailedDependencyException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::failed_dependency_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_failed_dependency_exception_json_err(response.body().as_ref(), output).map_err(crate::error::CreateCommentError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"InvalidCommentOperationException" => crate::error::CreateCommentError {
meta: generic,
kind: crate::error::CreateCommentErrorKind::InvalidCommentOperationException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output =
crate::error::invalid_comment_operation_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_invalid_comment_operation_exception_json_err(response.body().as_ref(), output).map_err(crate::error::CreateCommentError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"ProhibitedStateException" => crate::error::CreateCommentError {
meta: generic,
kind: crate::error::CreateCommentErrorKind::ProhibitedStateException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::prohibited_state_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_prohibited_state_exception_json_err(response.body().as_ref(), output).map_err(crate::error::CreateCommentError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"ServiceUnavailableException" => crate::error::CreateCommentError {
meta: generic,
kind: crate::error::CreateCommentErrorKind::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::CreateCommentError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"UnauthorizedOperationException" => crate::error::CreateCommentError {
meta: generic,
kind: crate::error::CreateCommentErrorKind::UnauthorizedOperationException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output =
crate::error::unauthorized_operation_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_unauthorized_operation_exception_json_err(response.body().as_ref(), output).map_err(crate::error::CreateCommentError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"UnauthorizedResourceAccessException" => crate::error::CreateCommentError {
meta: generic,
kind: crate::error::CreateCommentErrorKind::UnauthorizedResourceAccessException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output =
crate::error::unauthorized_resource_access_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_unauthorized_resource_access_exception_json_err(response.body().as_ref(), output).map_err(crate::error::CreateCommentError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
_ => crate::error::CreateCommentError::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_document_locked_for_comments_exception(&self) -> bool
pub fn is_document_locked_for_comments_exception(&self) -> bool
Returns true
if the error kind is CreateCommentErrorKind::DocumentLockedForCommentsException
.
sourcepub fn is_entity_not_exists_exception(&self) -> bool
pub fn is_entity_not_exists_exception(&self) -> bool
Returns true
if the error kind is CreateCommentErrorKind::EntityNotExistsException
.
sourcepub fn is_failed_dependency_exception(&self) -> bool
pub fn is_failed_dependency_exception(&self) -> bool
Returns true
if the error kind is CreateCommentErrorKind::FailedDependencyException
.
sourcepub fn is_invalid_comment_operation_exception(&self) -> bool
pub fn is_invalid_comment_operation_exception(&self) -> bool
Returns true
if the error kind is CreateCommentErrorKind::InvalidCommentOperationException
.
sourcepub fn is_prohibited_state_exception(&self) -> bool
pub fn is_prohibited_state_exception(&self) -> bool
Returns true
if the error kind is CreateCommentErrorKind::ProhibitedStateException
.
Returns true
if the error kind is CreateCommentErrorKind::ServiceUnavailableException
.
Returns true
if the error kind is CreateCommentErrorKind::UnauthorizedOperationException
.
Returns true
if the error kind is CreateCommentErrorKind::UnauthorizedResourceAccessException
.