pub enum ValidationError {
InvalidReference {
source_entity_type: &'static str,
source_id: EntityId,
field_name: &'static str,
referenced_id: EntityId,
expected_type: &'static str,
},
DuplicateId {
entity_type: &'static str,
id: EntityId,
},
CascadeCycle {
cycle_ids: Vec<EntityId>,
},
InvalidFillingConfig {
hydro_id: EntityId,
reason: String,
},
DisconnectedBus {
bus_id: EntityId,
},
InvalidPenalty {
entity_type: &'static str,
entity_id: EntityId,
field_name: &'static str,
reason: String,
},
}Expand description
Errors produced during System construction and validation.
Returned by the System builder when loading and validating entity collections.
Each variant captures enough context to pinpoint the invalid input without
requiring the caller to re-inspect the data.
§Examples
use cobre_core::{EntityId, ValidationError};
let err = ValidationError::DuplicateId {
entity_type: "Bus",
id: EntityId(1),
};
assert!(err.to_string().contains("Bus"));Variants§
InvalidReference
A cross-reference field (e.g., bus_id, downstream_id) refers to
an entity ID that does not exist in the system.
Fields
DuplicateId
Duplicate entity ID within a single entity collection.
Fields
CascadeCycle
The hydro cascade contains a cycle.
InvalidFillingConfig
A hydro’s filling configuration is invalid.
Fields
DisconnectedBus
A bus has no connections (no lines, generators, or loads).
Emitted by cobre-io validation.
InvalidPenalty
Entity-level penalty value is invalid (e.g., negative cost).
Emitted by cobre-io validation.
Trait Implementations§
Source§impl Clone for ValidationError
impl Clone for ValidationError
Source§fn clone(&self) -> ValidationError
fn clone(&self) -> ValidationError
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ValidationError
impl Debug for ValidationError
Source§impl Display for ValidationError
impl Display for ValidationError
Source§impl Error for ValidationError
impl Error for ValidationError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0:
use the Display impl or to_string()
Auto Trait Implementations§
impl Freeze for ValidationError
impl RefUnwindSafe for ValidationError
impl Send for ValidationError
impl Sync for ValidationError
impl Unpin for ValidationError
impl UnsafeUnpin for ValidationError
impl UnwindSafe for ValidationError
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
Mutably borrows from an owned value. Read more