#[non_exhaustive]pub enum Error {
Show 30 variants
Overflow {
quantity: &'static str,
operation: &'static str,
left: i128,
right: Option<i128>,
},
PowerOutOfRange {
watts: u64,
},
NegativeAmount {
power: Power,
},
ParsePower {
text: String,
reason: &'static str,
},
Inexact {
numerator: i128,
denominator: i128,
},
IspDuration {
minutes: u16,
},
GridSize {
count: u64,
},
TimeRange {
start: Timestamp,
count: u32,
},
Day {
date: Date,
zone: String,
reason: &'static str,
},
LocalTime {
date: Date,
time: Time,
zone: String,
reason: &'static str,
},
GridMismatch {
left: Grid,
right: Grid,
},
SeriesLength {
expected: u32,
actual: usize,
},
InvertedBounds {
min: Power,
max: Power,
},
DeviceId {
id: String,
reason: &'static str,
},
Receipt {
path: String,
reason: String,
},
InvertedLevel {
min: Energy,
max: Energy,
},
EmptyLevel {
after: IspLabel,
min: Energy,
max: Energy,
},
InitialLevel {
initial: Energy,
level: Level,
},
NotABoundary {
at: Timestamp,
grid: Grid,
},
InvertedBand {
min: Deviation,
max: Deviation,
},
Mismatch {
field: &'static str,
ours: String,
theirs: String,
},
Unrepresentable {
protocol: &'static str,
field: &'static str,
value: String,
reason: &'static str,
},
EmptyWindow {
from: Timestamp,
until: Timestamp,
},
EmptyRange {
isp: IspLabel,
min: Power,
max: Power,
},
GuaranteeBreached(Box<Breach>),
Method {
method: MethodId,
reason: String,
},
NoData {
what: &'static str,
},
ParseDigest {
text: String,
},
ParseMethod {
text: String,
},
IspRange {
first: u32,
last: u32,
count: u32,
},
}Expand description
Why an operation refused. Every variant names the values involved;
Display renders it as one line, and Error::hint suggests a remedy
where there is one.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Overflow
Arithmetic left the representable range.
Fields
PowerOutOfRange
A magnitude larger than the largest representable power.
NegativeAmount
An amount that must not be negative was.
ParsePower
Power text that is not an exact power with a unit.
Inexact
A division with Rounding::Exact left a remainder.
IspDuration
An ISP duration that does not divide a day into whole ISPs.
GridSize
A grid with no ISPs or more than MAX_ISPS.
TimeRange
A grid whose end lies outside the representable time range.
Day
A date that has no day grid in the zone.
LocalTime
A local wall-clock time that is skipped or repeated on its date, or out of range.
Fields
GridMismatch
Two values on different grids.
SeriesLength
A series with a different number of values than its grid has ISPs.
InvertedBounds
A minimum above the maximum.
DeviceId
A device id that is empty, longer than 64 characters or contains a control character.
Receipt
A received canonical text that is not a settlement this crate would write: not exactly canonical, another profile, or lines that break the settlement rule.
Fields
InvertedLevel
A level whose minimum is above its maximum.
EmptyLevel
Level bounds that together allow no level after an ISP.
Fields
InitialLevel
A level that must always hold, which the initial level already breaks.
NotABoundary
An instant that is not a boundary between ISPs of the grid.
InvertedBand
A deviation band whose minimum is above its maximum.
Mismatch
Two values that must agree do not, such as an order’s day and its settlement’s.
Unrepresentable
A protocol value this crate cannot hold, or a message it cannot read without guessing.
Fields
EmptyWindow
A window whose end is not after its start.
EmptyRange
A combination that leaves an ISP with no allowed power.
Fields
GuaranteeBreached(Box<Breach>)
A limit that would allow less than a guarantee in force.
Method
A baseline method refused its inputs or parameters.
NoData
An operation that needs data got none.
ParseDigest
Text that is not sha256: and 64 hex digits.
ParseMethod
Text that is not a known method id.
IspRange
ISPs outside a grid.
Implementations§
Trait Implementations§
impl Eq for Error
Source§impl Error for Error
impl Error for Error
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()