pub enum JournalEntryError {
NoLines,
Unbalanced {
debits: Decimal,
credits: Decimal,
difference: Decimal,
tolerance: Decimal,
},
LineHasBothDebitAndCredit,
LineHasNeitherDebitNorCredit,
NegativeAmount,
MissingAccountCode,
InvalidJournalType(String),
NonPositiveDebit,
NonPositiveCredit,
CrossOrgLine,
}Expand description
Domain-typed validation error for journal entries (double-entry bookkeeping).
Pure domain type — no infrastructure/application dependency (hexagonal
purity). Follows the codebase precedent ProxyValidationError (vote.rs):
the entity returns its own typed error; the application layer maps it to
AppError (see impl From<JournalEntryError> for AppError) so a malformed
entry surfaces as a 400 validation error, not a 500 Internal (#433 / WP-A3).
Variants§
NoLines
Entry has no lines.
Unbalanced
Sum of debits ≠ sum of credits beyond tolerance (double-entry rule).
LineHasBothDebitAndCredit
A line carries both a debit and a credit amount.
LineHasNeitherDebitNorCredit
A line carries neither a debit nor a credit amount.
NegativeAmount
A line has a negative debit or credit amount.
MissingAccountCode
A line is missing its PCMN account code.
InvalidJournalType(String)
Journal type is not one of ACH / VEN / FIN / ODS.
NonPositiveDebit
Debit line amount is not strictly positive.
NonPositiveCredit
Credit line amount is not strictly positive.
CrossOrgLine
A line belongs to a different organization than the entry (cross-org line injection — tenant isolation breach).
Trait Implementations§
Source§impl Clone for JournalEntryError
impl Clone for JournalEntryError
Source§fn clone(&self) -> JournalEntryError
fn clone(&self) -> JournalEntryError
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for JournalEntryError
impl Debug for JournalEntryError
Source§impl Display for JournalEntryError
impl Display for JournalEntryError
Source§impl Error for JournalEntryError
impl Error for JournalEntryError
1.30.0 · 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<JournalEntryError> for AppError
impl From<JournalEntryError> for AppError
Source§fn from(e: JournalEntryError) -> Self
fn from(e: JournalEntryError) -> Self
Une écriture comptable malformée est une erreur d’entrée client
(débit≠crédit, ligne invalide, type journal inconnu…) → 400
validation, jamais 500 Internal (le From<String> générique
mappait à tort vers Internal).
Source§impl From<JournalEntryError> for String
Bridge so existing Result<_, String> use-cases keep compiling while the
entity is typed (the use-case/port String→AppError cascade is a distinct,
broader slice — out of WP-A3 scope). Pure, std-only.
impl From<JournalEntryError> for String
Bridge so existing Result<_, String> use-cases keep compiling while the
entity is typed (the use-case/port String→AppError cascade is a distinct,
broader slice — out of WP-A3 scope). Pure, std-only.
Source§fn from(e: JournalEntryError) -> String
fn from(e: JournalEntryError) -> String
Source§impl PartialEq for JournalEntryError
impl PartialEq for JournalEntryError
Source§fn eq(&self, other: &JournalEntryError) -> bool
fn eq(&self, other: &JournalEntryError) -> bool
self and other values to be equal, and is used by ==.impl StructuralPartialEq for JournalEntryError
Auto Trait Implementations§
impl Freeze for JournalEntryError
impl RefUnwindSafe for JournalEntryError
impl Send for JournalEntryError
impl Sync for JournalEntryError
impl Unpin for JournalEntryError
impl UnsafeUnpin for JournalEntryError
impl UnwindSafe for JournalEntryError
Blanket Implementations§
Source§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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Fake for T
impl<T> Fake for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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