pub struct DynamoDBError {
pub code: DynamoDBErrorCode,
pub message: String,
pub status_code: StatusCode,
pub source: Option<Box<dyn Error + Send + Sync>>,
pub item: Option<HashMap<String, AttributeValue>>,
pub cancellation_reasons: Vec<CancellationReason>,
}Expand description
A DynamoDB error response.
Fields§
§code: DynamoDBErrorCodeThe error code.
message: StringA human-readable error message.
status_code: StatusCodeThe HTTP status code.
source: Option<Box<dyn Error + Send + Sync>>The underlying source error, if any.
item: Option<HashMap<String, AttributeValue>>The existing item to return in the error response (used by
ReturnValuesOnConditionCheckFailure=ALL_OLD).
cancellation_reasons: Vec<CancellationReason>Cancellation reasons for TransactionCanceledException.
Implementations§
Source§impl DynamoDBError
impl DynamoDBError
Sourcepub fn new(code: DynamoDBErrorCode) -> Self
pub fn new(code: DynamoDBErrorCode) -> Self
Create a new DynamoDBError from an error code.
Sourcepub fn with_message(code: DynamoDBErrorCode, message: impl Into<String>) -> Self
pub fn with_message(code: DynamoDBErrorCode, message: impl Into<String>) -> Self
Create a new DynamoDBError with a custom message.
Sourcepub fn with_source(self, source: impl Error + Send + Sync + 'static) -> Self
pub fn with_source(self, source: impl Error + Send + Sync + 'static) -> Self
Set the source error.
Sourcepub fn with_item(self, item: HashMap<String, AttributeValue>) -> Self
pub fn with_item(self, item: HashMap<String, AttributeValue>) -> Self
Attach an existing item to the error response (for
ReturnValuesOnConditionCheckFailure=ALL_OLD).
Sourcepub fn with_cancellation_reasons(self, reasons: Vec<CancellationReason>) -> Self
pub fn with_cancellation_reasons(self, reasons: Vec<CancellationReason>) -> Self
Attach cancellation reasons to a TransactionCanceledException.
Sourcepub fn error_type(&self) -> &'static str
pub fn error_type(&self) -> &'static str
Returns the __type string for the JSON error response.
Sourcepub fn resource_in_use(message: impl Into<String>) -> Self
pub fn resource_in_use(message: impl Into<String>) -> Self
Table already exists.
Sourcepub fn resource_not_found(message: impl Into<String>) -> Self
pub fn resource_not_found(message: impl Into<String>) -> Self
Table or resource not found.
Sourcepub fn conditional_check_failed(message: impl Into<String>) -> Self
pub fn conditional_check_failed(message: impl Into<String>) -> Self
Condition expression evaluated to false.
Sourcepub fn validation(message: impl Into<String>) -> Self
pub fn validation(message: impl Into<String>) -> Self
Validation error.
Sourcepub fn serialization_exception(message: impl Into<String>) -> Self
pub fn serialization_exception(message: impl Into<String>) -> Self
Serialization error.
Sourcepub fn internal_error(message: impl Into<String>) -> Self
pub fn internal_error(message: impl Into<String>) -> Self
Internal server error.
Sourcepub fn missing_action() -> Self
pub fn missing_action() -> Self
Missing action header.
Sourcepub fn transaction_cancelled(reasons: Vec<CancellationReason>) -> Self
pub fn transaction_cancelled(reasons: Vec<CancellationReason>) -> Self
Transaction cancelled with cancellation reasons.
Sourcepub fn unknown_operation(target: &str) -> Self
pub fn unknown_operation(target: &str) -> Self
Unknown operation.
Trait Implementations§
Source§impl Debug for DynamoDBError
impl Debug for DynamoDBError
Source§impl Display for DynamoDBError
impl Display for DynamoDBError
Source§impl Error for DynamoDBError
impl Error for DynamoDBError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()