pub enum PostingError {
Sqlx(Error),
DuplicateKey(Box<dyn DatabaseError>),
TxTemplateError(TxTemplateError),
VelocityError(VelocityError),
AccountSetError(AccountSetError),
BalanceError(BalanceError),
Rejected {
index: usize,
tx_id: TransactionId,
reason: Box<RejectionReason>,
},
BatchTooManyAccounts {
distinct: usize,
max: usize,
},
}Expand description
The posting module’s error — nested under
crate::ledger::error::LedgerError, never the other way around, exactly
like every other domain error.
Domain errors the flow passes through keep their own granularity via
#[from]; failures specific to the posting path get their own variants
here. Self::Rejected additionally attributes a failure to one posting
of the submitted batch.
Variants§
Sqlx(Error)
DuplicateKey(Box<dyn DatabaseError>)
TxTemplateError(TxTemplateError)
VelocityError(VelocityError)
AccountSetError(AccountSetError)
BalanceError(BalanceError)
Rejected
A failure attributed to a specific posting within a batch.
The batch API is all-or-nothing: the whole operation aborts on the
first failure. index and tx_id identify which posting of the
submitted batch caused it, so a caller can eject the offender and
retry the remainder without correlating an opaque error against its
input. Every reason is detected client-side, before the apply
statement runs, which is what keeps the failure attributable:
nothing has been written when it surfaces. Infrastructure failures
(constraint races, deadlocks, connection loss) are not attributable
and surface through the other variants.
BatchTooManyAccounts
The batch would hold more advisory locks than the shared lock table can
be relied on to provide. Refused up front, because the alternative is a
bare out of shared memory from Postgres that names neither the cause
nor the fix — and that can strike unrelated concurrent transactions too.
Trait Implementations§
Source§impl Debug for PostingError
impl Debug for PostingError
Source§impl Display for PostingError
impl Display for PostingError
Source§impl Error for PostingError
impl Error for PostingError
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()
Source§impl From<AccountSetError> for PostingError
impl From<AccountSetError> for PostingError
Source§fn from(source: AccountSetError) -> Self
fn from(source: AccountSetError) -> Self
Source§impl From<BalanceError> for PostingError
impl From<BalanceError> for PostingError
Source§fn from(source: BalanceError) -> Self
fn from(source: BalanceError) -> Self
Source§impl From<Error> for PostingError
impl From<Error> for PostingError
Source§impl From<PostingError> for LedgerError
impl From<PostingError> for LedgerError
Source§fn from(source: PostingError) -> Self
fn from(source: PostingError) -> Self
Source§impl From<TxTemplateError> for PostingError
impl From<TxTemplateError> for PostingError
Source§fn from(source: TxTemplateError) -> Self
fn from(source: TxTemplateError) -> Self
Source§impl From<VelocityError> for PostingError
impl From<VelocityError> for PostingError
Source§fn from(source: VelocityError) -> Self
fn from(source: VelocityError) -> Self
Auto Trait Implementations§
impl !RefUnwindSafe for PostingError
impl !UnwindSafe for PostingError
impl Freeze for PostingError
impl Send for PostingError
impl Sync for PostingError
impl Unpin for PostingError
impl UnsafeUnpin for PostingError
Blanket Implementations§
Source§impl<T> AnyExt for T
impl<T> AnyExt for T
Source§fn downcast_ref<T>(this: &Self) -> Option<&T>where
T: Any,
fn downcast_ref<T>(this: &Self) -> Option<&T>where
T: Any,
T behind referenceSource§fn downcast_mut<T>(this: &mut Self) -> Option<&mut T>where
T: Any,
fn downcast_mut<T>(this: &mut Self) -> Option<&mut T>where
T: Any,
T behind mutable referenceSource§fn downcast_rc<T>(this: Rc<Self>) -> Result<Rc<T>, Rc<Self>>where
T: Any,
fn downcast_rc<T>(this: Rc<Self>) -> Result<Rc<T>, Rc<Self>>where
T: Any,
T behind Rc pointerSource§fn downcast_arc<T>(this: Arc<Self>) -> Result<Arc<T>, Arc<Self>>where
T: Any,
fn downcast_arc<T>(this: Arc<Self>) -> Result<Arc<T>, Arc<Self>>where
T: Any,
T behind Arc pointerSource§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T, X> CoerceTo<T> for Xwhere
T: CoerceFrom<X> + ?Sized,
impl<T, X> CoerceTo<T> for Xwhere
T: CoerceFrom<X> + ?Sized,
fn coerce_rc_to(self: Rc<X>) -> Rc<T>
fn coerce_box_to(self: Box<X>) -> Box<T>
fn coerce_ref_to(&self) -> &T
fn coerce_mut_to(&mut self) -> &mut T
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
Source§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more