1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
//! Error type for all calculator operations in `dpp-calc`.
#[derive(Debug, thiserror::Error)]
pub enum CalcError {
#[error("invalid input: {0}")]
InvalidInput(String),
/// The ruleset's effective period has ended; a newer version is required.
#[error("ruleset '{id}' expired on {until}")]
RulesetExpired { id: String, until: String },
/// The ruleset's effective period has a known start date that has not
/// arrived yet.
#[error("ruleset '{id}' is not yet effective (in force from {from})")]
RulesetNotYetEffective { id: String, from: String },
/// The ruleset has no application date at all, because the instrument that
/// would date it has not entered into force. Distinct from
/// [`RulesetNotYetEffective`](Self::RulesetNotYetEffective): that one knows
/// the date and is waiting for it, this one cannot know it yet.
#[error("ruleset '{id}' has no application date yet — awaiting {empowerment}")]
RulesetUndetermined { id: String, empowerment: String },
/// A computation overflowed to a non-finite value despite finite, in-range
/// inputs — a legally cited figure must never silently become Infinity.
#[error("calculation overflow: {0}")]
Overflow(String),
/// The requested activity UUID is not present in the injected factor dataset.
#[error("emission factor not found for activity '{0}'")]
FactorNotFound(String),
/// The supplied data cannot be processed by this methodology.
#[error("methodology mismatch: {0}")]
MethodologyMismatch(String),
/// The methodology is defined but not yet implemented (gate: data license / delegated act).
#[error("not implemented: {methodology} — {reason}")]
NotImplemented { methodology: String, reason: String },
/// A parameter combination that is internally incoherent per the ruleset.
#[error("cross-field validation failed: {0}")]
CrossFieldViolation(String),
/// JSON canonicalization failed — inputs or outputs could not be serialized.
#[error("canonicalization error: {0}")]
CanonicalizeError(String),
}