View Source Dynamo.Error exception (Dynamo v0.2.0)
The single error type returned by every Dynamo operation.
All failures — AWS service errors, transport errors and local validation
failures — are normalised into %Dynamo.Error{} at the client boundary, so
code above the client never has to inspect raw AWS payloads.
case MyApp.Repo.put(user, condition: "attribute_not_exists(pk)") do
{:ok, user} -> ...
{:error, %Dynamo.Error{type: :conditional_check_failed}} -> ...
{:error, %Dynamo.Error{retryable?: true} = e} -> retry_later(e)
endFields
:type– categorised atom, e.g.:resource_not_found,:conditional_check_failed,:throttled,:validation_error,:transaction_canceled,:transport_error:message– human readable message:aws_type– the un-namespaced AWS exception name, when applicable:status– HTTP status, when applicable:retryable?– whether retrying the same request may succeed:cancellation_reasons– for:transaction_canceled, one entry per transact item withcode,messageanditem:details– any additional structured data (raw AWS body, exception…)
Summary
Functions
Normalises an AWS error response body (already JSON decoded) plus HTTP status.
Builds a local (non-AWS) error, e.g. a validation failure.
Whether an error of this type is worth retrying.
Wraps a transport level failure (connection refused, timeout…).
Builds a :validation_error.
Types
Functions
@spec from_aws(map() | binary(), non_neg_integer()) :: t()
Normalises an AWS error response body (already JSON decoded) plus HTTP status.
Handles both "__type" forms DynamoDB uses ("ResourceNotFoundException"
and "com.amazonaws.dynamodb.v20120810#ResourceNotFoundException") and both
message keys ("message" and "Message").
Builds a local (non-AWS) error, e.g. a validation failure.
Whether an error of this type is worth retrying.
Wraps a transport level failure (connection refused, timeout…).
Builds a :validation_error.