pub enum LoadError {
IoError {
path: PathBuf,
source: Error,
},
ParseError {
path: PathBuf,
message: String,
},
SchemaError {
path: PathBuf,
field: String,
message: String,
},
CrossReferenceError {
source_file: PathBuf,
source_entity: String,
target_collection: String,
target_entity: String,
},
ConstraintError {
description: String,
},
PolicyIncompatible {
check: String,
policy_value: String,
system_value: String,
},
}Expand description
Errors that can occur during case loading.
Variants are ordered by the pipeline phase in which they typically occur: I/O read → parse → schema validation → cross-reference validation → semantic constraint validation → warm-start policy compatibility.
§Examples
use cobre_io::LoadError;
use std::path::PathBuf;
let err = LoadError::SchemaError {
path: PathBuf::from("system/hydros.json"),
field: "bus_id".to_string(),
message: "required field is missing".to_string(),
};
assert!(err.to_string().contains("bus_id"));Variants§
IoError
Filesystem read failure (file not found, permission denied, I/O error).
ParseError
JSON or Parquet parsing failure (malformed content, encoding error).
Fields
SchemaError
Schema validation failure (missing required field, wrong type, value out of range).
Fields
CrossReferenceError
Cross-reference validation failure (dangling entity ID, broken foreign key).
Fields
source_entity: StringString identifier of the entity that holds the broken reference
(e.g., "Hydro 'H1'").
ConstraintError
Semantic constraint violation (acyclic cascade, complete coverage, consistency).
PolicyIncompatible
Warm-start policy is structurally incompatible with the current system.
See SS7.1 in input-loading-pipeline.md for the four compatibility checks.
Implementations§
Source§impl LoadError
impl LoadError
Sourcepub fn io(path: impl AsRef<Path>, source: Error) -> Self
pub fn io(path: impl AsRef<Path>, source: Error) -> Self
Construct an LoadError::IoError wrapping an std::io::Error with path context.
Do not implement From<std::io::Error> instead — that conversion loses
the path context required for diagnostic messages.
§Examples
use cobre_io::LoadError;
use std::io;
let io_err = io::Error::new(io::ErrorKind::NotFound, "no such file");
let err = LoadError::io("system/hydros.json", io_err);
assert!(err.to_string().contains("system/hydros.json"));Sourcepub fn parse(path: impl AsRef<Path>, message: impl Into<String>) -> Self
pub fn parse(path: impl AsRef<Path>, message: impl Into<String>) -> Self
Construct a LoadError::ParseError with path context and a message.
§Examples
use cobre_io::LoadError;
let err = LoadError::parse("stages.json", "unexpected end of input");
assert!(err.to_string().contains("stages.json"));
assert!(err.to_string().contains("unexpected end of input"));Trait Implementations§
Source§impl Error for LoadError
impl Error for LoadError
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()
Auto Trait Implementations§
impl !RefUnwindSafe for LoadError
impl !UnwindSafe for LoadError
impl Freeze for LoadError
impl Send for LoadError
impl Sync for LoadError
impl Unpin for LoadError
impl UnsafeUnpin for LoadError
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§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