Skip to main content

DataError

Enum DataError 

Source
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.

Fields

§reason: String
§

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).

Fields

§reason: String
§

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.

Fields

§reason: String
§

EmptyInput

The source has no headers, no rows, or contains an empty / missing field at a row that requires a value.

Fields

§reason: String
§

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.

Fields

§reason: String
§

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

§name: String

The missing column name, exactly as the user wrote it.

§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.

§available: Vec<String>

All headers present in the input table at resolution time, sorted.

§similar: Vec<String>

Cheap similarity suggestions (case-insensitive substring or shared-prefix length ≥ 3), sorted; empty when no header is close.

§tsv_hint: bool

True iff the available set has exactly one entry and that entry contains a literal tab — i.e. the user almost certainly handed gam a TSV file under a .csv filename. Surfaced as a structured boolean rather than re-parsed from prose at the boundary.

Implementations§

Source§

impl DataError

Source

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 Clone for DataError

Source§

fn clone(&self) -> DataError

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for DataError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for DataError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Error for DataError

1.30.0 · Source§

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

👎Deprecated since 1.42.0:

use the Display impl or to_string()

1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl From<DataError> for String

Source§

fn from(err: DataError) -> String

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.