#[non_exhaustive]pub struct TransactionError {
pub cause: Error,
pub rollback: Rollback,
}Expand description
The error Jj::transaction returns when its closure fails. It preserves the
closure’s own error in cause — the same value the previous
(rollback-swallowing) Result<T> contract returned — and additionally records
what the concurrency-safe rollback did in rollback, so a
failed or refused rollback is visible to the caller instead of silently
dropped (the earlier let _ = op_restore(..) discarded it).
Match rollback to distinguish Restored / SkippedDiverged
/ Failed; call into_cause for a drop-in of the old
“closure error only” behavior.
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.cause: ErrorThe error the closure returned — the transaction’s root cause.
rollback: RollbackWhat the concurrency-safe rollback did in response to cause.
Implementations§
Source§impl TransactionError
impl TransactionError
Sourcepub fn cause(&self) -> &Error
pub fn cause(&self) -> &Error
The closure’s error — the transaction’s root cause (what the old Result<T>
contract returned).
Sourcepub fn rollback(&self) -> &Rollback
pub fn rollback(&self) -> &Rollback
What the rollback did — Restored /
SkippedDiverged / Failed.
Sourcepub fn into_cause(self) -> Error
pub fn into_cause(self) -> Error
Consume, returning just the closure’s error — the drop-in for code that only wants the old “closure error” and does not act on the rollback outcome.
Trait Implementations§
Source§impl Debug for TransactionError
impl Debug for TransactionError
Source§impl Display for TransactionError
impl Display for TransactionError
Source§impl Error for TransactionError
impl Error for TransactionError
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()