pub enum DataError {
SchemaMismatch {
reason: String,
},
ParseError {
reason: String,
},
EncodingFailure {
reason: String,
},
EmptyInput {
reason: String,
},
InvalidValue {
reason: String,
},
ColumnNotFound {
name: String,
role: Option<String>,
available: Vec<String>,
similar: Vec<String>,
tsv_hint: bool,
},
}Expand description
Typed error variants for the data-loading module.
Public entry points continue to return Result<_, String>; this enum is
materialized at leaf sites and converted at the boundary via
From<DataError> for String so error text remains byte-identical to the
previous ad-hoc format!(...) output.
Variants§
SchemaMismatch
Schema/column shape disagrees with the file: row width mismatch,
requested column missing from headers, schema-declared kind violated by
a row, or an unseen categorical level encountered under
UnseenCategoryPolicy::Error.
ParseError
Failed to open, decode, or read structural bytes of the source (CSV/TSV row read, parquet metadata, file extension detection, parquet arrow-cast for string columns).
EncodingFailure
Internal encoding bookkeeping failed: a categorical map expected by the schema path was missing, or a level expected to be present in the per-column inference state was not found during fix-up.
EmptyInput
The source has no headers, no rows, or contains an empty / missing field at a row that requires a value.
InvalidValue
A cell value cannot be used as a feature: non-finite float, null in a numeric parquet column, or an unsupported parquet data type for the column.
ColumnNotFound
A formula or call site references a column name that is not present in
the input data. Structured so the FFI boundary can raise a typed
Python exception (gamfit.ColumnNotFoundError) carrying the missing
name, available columns, and similarity suggestions as attributes —
not as a parsed-back-out substring of the human display text.
Fields
role: Option<String>Optional role label ("response", "entry", "exit", etc.)
supplied at the resolution site to disambiguate which slot in the
formula referenced the bad name. None for bare term references.
Implementations§
Source§impl DataError
impl DataError
Sourcepub fn column_not_found(
col_map: &HashMap<String, usize>,
name: &str,
role: Option<&str>,
) -> Self
pub fn column_not_found( col_map: &HashMap<String, usize>, name: &str, role: Option<&str>, ) -> Self
Build a typed ColumnNotFound from the column map of the resolved
dataset. Centralises the similarity / TSV-hint heuristics that the
legacy missing_column_message helper used to perform inline so all
callers — leaf resolve_col* shims and the multi-column requested-
columns aggregator — produce identical payloads.
Trait Implementations§
Source§impl Error for DataError
impl Error for DataError
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()
Auto Trait Implementations§
impl Freeze for DataError
impl RefUnwindSafe for DataError
impl Send for DataError
impl Sync for DataError
impl Unpin for DataError
impl UnsafeUnpin for DataError
impl UnwindSafe for DataError
Blanket Implementations§
impl<T> Allocation for T
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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