pub enum EngineError {
ValidationBlocked {
warnings: Vec<BillingWarning>,
},
PriceOutOfRange {
field: String,
value: Decimal,
},
InvalidPeriod {
from: Date,
to: Date,
},
AllocationMismatch {
fractions: usize,
contexts: usize,
},
AllocationWeightsInvalid {
sum: Decimal,
},
NutzungsplanSharesInvalid {
sum: Decimal,
},
Unrepresentable {
field: String,
value: String,
},
ReconciliationFailed {
reason: String,
},
Arithmetic(BillingError),
}Expand description
Errors returned by BillingEngine::bill and
the invoice assembly functions.
Variants§
ValidationBlocked
One or more providers raised Error-severity regulatory warnings
during validation — the run must not produce an invoice.
Carries all warnings collected up to and including the blocking
provider, so the caller sees every violation at once. The blocking
ones are those with WarningSeverity::Error.
Fields
warnings: Vec<BillingWarning>All warnings collected before the run was aborted.
PriceOutOfRange
A tariff price could not be represented in the monetary type.
Raised when a configured ct/kWh price exceeds the Amount range —
in practice always a corrupt tariff, never a real price.
Fields
InvalidPeriod
A billing period whose end precedes its start.
Unreachable through BillingPeriod::new —
this is what the constructor returns, making the invalid pair
unrepresentable everywhere downstream.
AllocationMismatch
Invoice::allocate_proportionally was called with mismatched shapes.
Fields
AllocationWeightsInvalid
Invoice::allocate_proportionally was given weights it cannot normalise.
A negative weight is not an allocation share, and weights summing to zero name no recipient at all. Both are caller mistakes rather than arithmetic failures, so they are refused before the split runs.
A §42b EEG Nutzungsplan whose shares do not describe an allocation.
The plan’s fractions are caller-supplied and must partition the plant’s generation exactly once — a plan entered as percentages allocates a hundred times the generation, and one summing short leaves kWh unallocated. Refused before the split rather than distributed.
Unrepresentable
A value the EN 16931 semantic model cannot represent.
A rendered e-invoice is a legally binding document: a line amount
saturated to 0.00, or a BT-2 Ausstellungsdatum taken from a fallback
constant, states as fact something § 14 Abs. 4 UStG requires the document
to get right. Both are refused rather than emitted.
Fields
ReconciliationFailed
EN 16931 reconciliation (BG-22/BG-23, BR-CO-10..16) failed.
The breakdown and the totals of an e-invoice are derived, and a derivation that fails leaves the document carrying whichever totals the builder happened to hold — a document that states amounts nothing computed. Refused rather than emitted.
Arithmetic(BillingError)
An arithmetic or document error from the billing core —
monetary overflow, invalid schedule, tax-layer failure.
Implementations§
Source§impl EngineError
impl EngineError
Sourcepub const fn code(&self) -> &'static str
pub const fn code(&self) -> &'static str
Stable machine-readable code for structured error responses.
Sourcepub fn blocking_warnings(&self) -> &[BillingWarning]
pub fn blocking_warnings(&self) -> &[BillingWarning]
The Error-severity warnings that blocked the run, when this is a
ValidationBlocked.
Trait Implementations§
Source§impl Clone for EngineError
impl Clone for EngineError
Source§fn clone(&self) -> EngineError
fn clone(&self) -> EngineError
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 EngineError
impl Debug for EngineError
Source§impl Display for EngineError
impl Display for EngineError
Source§impl Error for EngineError
impl Error for EngineError
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()