Skip to main content

TxRunError

Enum TxRunError 

Source
pub enum TxRunError<E> {
    Rollback(E),
    RollbackOnly {
        reason: String,
    },
    CommitRejected {
        reason: String,
    },
    CommitUncertain {
        reason: String,
    },
    RollbackFailed {
        cause: TxRollbackCause<E>,
        reason: String,
    },
    Infrastructure {
        reason: String,
    },
}
Expand description

业务作用:封闭提交、回滚和基础设施失败分类,供消息 ACK 与重试策略裁决。

Variants§

§

Rollback(E)

业务要求回滚,且数据库确认回滚完成。

§

RollbackOnly

内层回滚要求被外层吞掉,最外层已确认整体回滚。

Fields

§reason: String

首次置位 rollback-only 时保存的脱敏原因。

§

CommitRejected

数据库明确拒绝 COMMIT。

Fields

§reason: String

稳定、脱敏的失败分类。

§

CommitUncertain

COMMIT 后连接或协议状态不确定。

Fields

§reason: String

稳定、脱敏的失败分类。

§

RollbackFailed

物理回滚失败。

Fields

§cause: TxRollbackCause<E>

触发回滚的原始裁决。

§reason: String

稳定、脱敏的基础设施分类。

§

Infrastructure

在事务开始前或内核执行中发生基础设施错误。

Fields

§reason: String

稳定、脱敏的失败分类。

Trait Implementations§

Source§

impl<E: Debug> Debug for TxRunError<E>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<E: Display> Display for TxRunError<E>

Source§

fn fmt(&self, formatter: &mut Formatter<'_>) -> Result

业务作用:输出不含 SQL、连接串和 payload 的事务失败分类。

参数说明:

  • formatter:是标准格式化目标。

返回:分类写入成功时返回 Ok,否则返回格式化错误。

Source§

impl<E> Error for TxRunError<E>
where E: Debug + Display,

1.30.0 · Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0:

use the Display impl or to_string()

1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more

Auto Trait Implementations§

§

impl<E> Forget for TxRunError<E>

§

impl<E> Freeze for TxRunError<E>

§

impl<E> Move for TxRunError<E>

§

impl<E> RefUnwindSafe for TxRunError<E>

§

impl<E> Send for TxRunError<E>
where E: Send, TxRollbackCause<E>: Send,

§

impl<E> Sync for TxRunError<E>
where E: Sync, TxRollbackCause<E>: Sync,

§

impl<E> Unpin for TxRunError<E>
where E: Unpin, TxRollbackCause<E>: Unpin,

§

impl<E> UnsafeUnpin for TxRunError<E>

§

impl<E> UnwindSafe for TxRunError<E>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more