Normalized error for distributed SuperCache operations.
Every failure that crosses a node boundary — an unreachable primary,
an :erpc timeout, a remote exception, or an exit raised while applying
an operation — is converted into this exception before it reaches a
caller. That keeps raw :exit signals and transport-specific tuples out
of application code.
Fields
| Field | Meaning |
|---|---|
operation | Operation that failed, usually {module, function} or an atom |
partition | Partition index the operation targeted, when known |
node | Node the operation was sent to, when known |
mode | Replication or read mode active for the operation, when known |
reason | Normalized underlying reason (:nodedown, :timeout, …) |
message | Optional caller-supplied message; overrides the generated one |
Error contract
Bang APIs (put!/1, get!/2, …) raise this exception. Non-bang APIs
(put/1, get/2, …) return {:error, %SuperCache.Cluster.Error{}}
instead of raising or leaking an exit.
Examples
error = %SuperCache.Cluster.Error{
operation: :put,
partition: 3,
node: :"cache@10.0.0.2",
mode: :strong,
reason: :nodedown
}
Exception.message(error)
# => "distributed operation put failed on partition 3 at node :"cache@10.0.0.2" (mode :strong): nodedown"