pub enum DatasetError {
DownloadError(Error),
ValidationError(String),
UnzipError(ZipError),
IoError(Error),
DataFormatError(DataFormatErrorKind),
}Expand description
Error type used by dataset loading utilities.
§Variants
DownloadError- The download step failed (network, invalid URL, or downloader configuration).ValidationError- Downloaded file content failed integrity validation (SHA256 mismatch).UnzipError- Extracting a zip archive failed.IoError- A standard I/O operation failed (reading directories, opening/removing files, etc.).DataFormatError- The dataset content was not in the expected format.
Variants§
DownloadError(Error)
ValidationError(String)
UnzipError(ZipError)
IoError(Error)
DataFormatError(DataFormatErrorKind)
Implementations§
Source§impl DatasetError
impl DatasetError
Sourcepub fn sha256_validation_failed(dataset_name: &str, file_name: &str) -> Self
pub fn sha256_validation_failed(dataset_name: &str, file_name: &str) -> Self
Creates a standard SHA256 validation failure error message for a file.
§Parameters
dataset_name- The dataset identifier used in the error prefix.file_name- The dataset file name that failed checksum validation.
§Returns
DatasetError::ValidationError- A variant ofDatasetErrorthat contains the unified SHA256 failure message.
Sourcepub fn csv_read_error(dataset_name: &str, error: impl Display) -> Self
pub fn csv_read_error(dataset_name: &str, error: impl Display) -> Self
Sourcepub fn invalid_column_count(
dataset_name: &str,
expected: usize,
actual: usize,
line_num: usize,
line: &str,
) -> Self
pub fn invalid_column_count( dataset_name: &str, expected: usize, actual: usize, line_num: usize, line: &str, ) -> Self
Creates a unified invalid-column-count data format error.
§Parameters
dataset_name- The dataset identifier used in the error prefix.expected- The expected number of columns.actual- The actual number of columns found.line_num- The line number (1-based) where the error occurred.line- The original input line that failed validation.
§Returns
DatasetError::DataFormatError(DataFormatErrorKind::InvalidColumnCount)- A variant ofDatasetErrordescribing the column count mismatch.
Sourcepub fn parse_failed(
dataset_name: &str,
field_name: &str,
line_num: usize,
line: &str,
err: impl Display,
) -> Self
pub fn parse_failed( dataset_name: &str, field_name: &str, line_num: usize, line: &str, err: impl Display, ) -> Self
Creates a unified parse failure data format error.
§Parameters
dataset_name- The dataset identifier.field_name- The logical field name that failed to parse.line_num- The line number (1-based) where the error occurred.line- The original input line where parsing failed.err- The underlying parser error detail.
§Returns
DatasetError::DataFormatError(DataFormatErrorKind::ParseFailed)- A variant ofDatasetErrordescribing the parse failure.
Sourcepub fn invalid_value(
dataset_name: &str,
field_name: &str,
value: &str,
line_num: usize,
line: &str,
) -> Self
pub fn invalid_value( dataset_name: &str, field_name: &str, value: &str, line_num: usize, line: &str, ) -> Self
Creates a unified invalid-field-value data format error.
§Parameters
dataset_name- The dataset identifier.field_name- The logical field name with an invalid value.value- The invalid raw value.line_num- The line number (1-based) where the error occurred.line- The original input line where the invalid value was found.
§Returns
DatasetError::DataFormatError(DataFormatErrorKind::InvalidValue)- A variant ofDatasetErrordescribing the invalid value.
Sourcepub fn length_mismatch(
dataset_name: &str,
field_name: &str,
expected: usize,
actual: usize,
) -> Self
pub fn length_mismatch( dataset_name: &str, field_name: &str, expected: usize, actual: usize, ) -> Self
Creates a unified vector/row length mismatch data format error.
§Parameters
dataset_name- The dataset identifier.field_name- The logical field name whose length is being validated.expected- The expected length.actual- The actual length.
§Returns
DatasetError::DataFormatError(DataFormatErrorKind::LengthMismatch)- A variant ofDatasetErrordescribing the length mismatch.
Sourcepub fn array_shape_error(
dataset_name: &str,
array_name: &str,
err: impl Display,
) -> Self
pub fn array_shape_error( dataset_name: &str, array_name: &str, err: impl Display, ) -> Self
Creates a unified ndarray shape construction data format error.
§Parameters
dataset_name- The dataset identifier.array_name- The logical array name that failed to build.err- The underlying ndarray shape construction error detail.
§Returns
DatasetError::DataFormatError(DataFormatErrorKind::ArrayShapeError)- A variant ofDatasetErrordescribing the array shape failure.
Sourcepub fn empty_dataset(dataset_name: &str) -> Self
pub fn empty_dataset(dataset_name: &str) -> Self
Trait Implementations§
Source§impl Debug for DatasetError
impl Debug for DatasetError
Source§impl Display for DatasetError
impl Display for DatasetError
Source§impl Error for DatasetError
impl Error for DatasetError
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()
Source§impl From<DataFormatErrorKind> for DatasetError
impl From<DataFormatErrorKind> for DatasetError
Source§fn from(source: DataFormatErrorKind) -> Self
fn from(source: DataFormatErrorKind) -> Self
Converts to this type from the input type.
Source§impl From<Error> for DatasetError
impl From<Error> for DatasetError
Source§impl From<Error> for DatasetError
impl From<Error> for DatasetError
Auto Trait Implementations§
impl Freeze for DatasetError
impl !RefUnwindSafe for DatasetError
impl Send for DatasetError
impl Sync for DatasetError
impl Unpin for DatasetError
impl UnsafeUnpin for DatasetError
impl !UnwindSafe for DatasetError
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