Skip to main content

DataProfilerError

Enum DataProfilerError 

Source
pub enum DataProfilerError {
Show 24 variants
#[non_exhaustive]
CsvParsingError { message: String, suggestion: String, source: Option<Box<dyn Error + Send + Sync>>, }, FileNotFound { path: String, }, UnsupportedFormat { format: String, },
#[non_exhaustive]
InvalidConfiguration { message: String, suggestion: String, source: Option<Box<dyn Error + Send + Sync>>, }, InvalidSemanticHint { message: String, suggestion: String, },
#[non_exhaustive]
StreamingError { message: String, suggestion: String, source: Option<Box<dyn Error + Send + Sync>>, },
#[non_exhaustive]
IoError { message: String, source: Option<Box<dyn Error + Send + Sync>>, }, EncodingError { path: String, detail: String, guess: String, },
#[non_exhaustive]
BinaryInput { path: String, detected: String, suggestion: String, },
#[non_exhaustive]
SourceChanged { path: String, detail: String, suggestion: String, },
#[non_exhaustive]
JsonParsingError { message: String, source: Option<Box<dyn Error + Send + Sync>>, },
#[non_exhaustive]
ParquetError { message: String, source: Option<Box<dyn Error + Send + Sync>>, },
#[non_exhaustive]
ArrowError { message: String, source: Option<Box<dyn Error + Send + Sync>>, }, UnsupportedDataSource { message: String, }, AllEnginesFailed { message: String, }, MetricsCalculationError { message: String, }, DuplicateColumnName { names: String, plural: String, source_label: String, }, ConfigValidationError { message: String, }, DatabaseConnectionError { message: String, suggestion: String, }, DatabaseQueryError { message: String, }, DatabaseConfigError { message: String, }, DatabaseFeatureDisabled { message: String, }, SqlValidationError { message: String, }, DatabaseSslError { message: String, },
}
Expand description

Enhanced error types with more descriptive messages for DataProfiler

Not Clone: a retained ErrorSource is a boxed trait object, and the originating errors (std::io::Error, csv::Error, …) are not cloneable themselves.

Variants§

§

#[non_exhaustive]
CsvParsingError

Fields

This variant is marked as non-exhaustive
Non-exhaustive enum variants could have additional fields added in future. Therefore, non-exhaustive enum variants cannot be constructed in external crates and cannot be matched against.
§message: String
§suggestion: String
§source: Option<Box<dyn Error + Send + Sync>>
§

FileNotFound

Fields

§path: String
§

UnsupportedFormat

Fields

§format: String
§

#[non_exhaustive]
InvalidConfiguration

Fields

This variant is marked as non-exhaustive
Non-exhaustive enum variants could have additional fields added in future. Therefore, non-exhaustive enum variants cannot be constructed in external crates and cannot be matched against.
§message: String
§suggestion: String
§source: Option<Box<dyn Error + Send + Sync>>
§

InvalidSemanticHint

Fields

§message: String
§suggestion: String
§

#[non_exhaustive]
StreamingError

Fields

This variant is marked as non-exhaustive
Non-exhaustive enum variants could have additional fields added in future. Therefore, non-exhaustive enum variants cannot be constructed in external crates and cannot be matched against.
§message: String
§suggestion: String
§source: Option<Box<dyn Error + Send + Sync>>
§

#[non_exhaustive]
IoError

Fields

This variant is marked as non-exhaustive
Non-exhaustive enum variants could have additional fields added in future. Therefore, non-exhaustive enum variants cannot be constructed in external crates and cannot be matched against.
§message: String
§source: Option<Box<dyn Error + Send + Sync>>
§

EncodingError

Fields

§path: String
§detail: String
§guess: String
§

#[non_exhaustive]
BinaryInput

A file whose signature bytes name a binary format (gzip, zstd, zip, Parquet) was about to reach a text reader (#893). Built with DataProfilerError::binary_input.

Fields

This variant is marked as non-exhaustive
Non-exhaustive enum variants could have additional fields added in future. Therefore, non-exhaustive enum variants cannot be constructed in external crates and cannot be matched against.
§path: String
§detected: String

What the signature says the file is, e.g. gzip-compressed.

§suggestion: String
§

#[non_exhaustive]
SourceChanged

A remote object changed between the ranged reads of one profile, so the bytes read do not all come from one version of it (#865). Built with DataProfilerError::source_changed.

Fields

This variant is marked as non-exhaustive
Non-exhaustive enum variants could have additional fields added in future. Therefore, non-exhaustive enum variants cannot be constructed in external crates and cannot be matched against.
§path: String
§detail: String

What showed the change, e.g. the server answering 412 to If-Match.

§suggestion: String
§

#[non_exhaustive]
JsonParsingError

Fields

This variant is marked as non-exhaustive
Non-exhaustive enum variants could have additional fields added in future. Therefore, non-exhaustive enum variants cannot be constructed in external crates and cannot be matched against.
§message: String
§source: Option<Box<dyn Error + Send + Sync>>
§

#[non_exhaustive]
ParquetError

Fields

This variant is marked as non-exhaustive
Non-exhaustive enum variants could have additional fields added in future. Therefore, non-exhaustive enum variants cannot be constructed in external crates and cannot be matched against.
§message: String
§source: Option<Box<dyn Error + Send + Sync>>
§

#[non_exhaustive]
ArrowError

Fields

This variant is marked as non-exhaustive
Non-exhaustive enum variants could have additional fields added in future. Therefore, non-exhaustive enum variants cannot be constructed in external crates and cannot be matched against.
§message: String
§source: Option<Box<dyn Error + Send + Sync>>
§

UnsupportedDataSource

Fields

§message: String
§

AllEnginesFailed

Fields

§message: String
§

MetricsCalculationError

Fields

§message: String
§

DuplicateColumnName

Fields

§names: String
§plural: String
§source_label: String
§

ConfigValidationError

Fields

§message: String
§

DatabaseConnectionError

Fields

§message: String
§suggestion: String
§

DatabaseQueryError

Fields

§message: String
§

DatabaseConfigError

Fields

§message: String
§

DatabaseFeatureDisabled

Fields

§message: String
§

SqlValidationError

Fields

§message: String
§

DatabaseSslError

Fields

§message: String

Implementations§

Source§

impl DataProfilerError

Source

pub fn database_connection(message: &str) -> DataProfilerError

Create a database connection error.

The message is scrubbed of URL credentials before storage so a driver error that echoes the connection string cannot leak the password.

Source

pub fn database_query(message: &str) -> DataProfilerError

Create a database query error.

Redacts URL credentials that a driver error might surface; the raw SQL text and bound parameter values are never embedded by callers.

Source

pub fn database_config(message: &str) -> DataProfilerError

Create a database config error

Source

pub fn database_feature_disabled( db_name: &str, feature: &str, ) -> DataProfilerError

Create a feature-not-enabled error

Source

pub fn sql_validation(message: &str) -> DataProfilerError

Create a SQL validation error

Source

pub fn database_ssl(message: &str) -> DataProfilerError

Create a database SSL error

Source

pub fn duplicate_column_name( duplicates: &[String], source: &str, ) -> DataProfilerError

Create a duplicate-column-name error from the already-collected list of repeated names and a short transport label.

Only the offending names and the source are embedded — never row values — so the diagnostic cannot leak cell data.

Source

pub fn csv_parsing( original_error: &str, file_path: Option<&str>, ) -> DataProfilerError

Create a CSV parsing error with helpful suggestions.

file_path is None at boundaries that do not know the source (e.g. the From<csv::Error> conversion); pass Some(path) whenever it is known so the suggestion can name the offending file instead of a placeholder.

Source

pub fn csv_parsing_from<E>( original: E, file_path: Option<&str>, ) -> DataProfilerError
where E: Error + Send + Sync + 'static,

Create a CSV parsing error that retains original as its source.

The suggestion is derived from the same message text as DataProfilerError::csv_parsing, so the two forms render identically; only the cause chain differs.

Source

pub fn file_not_found<P>(path: P) -> DataProfilerError
where P: AsRef<str>,

Create a file not found error with path context

Source

pub fn binary_input( path: &Path, signature: BinarySignature, ) -> DataProfilerError

A file at path whose bytes carry signature, refused before a text reader parses it.

Source

pub fn source_changed( path: &str, detail: impl Into<String>, ) -> DataProfilerError

The object at path changed while it was being read; detail says how that showed.

Source

pub fn unsupported_format(extension: &str) -> DataProfilerError

Create unsupported format error with format detection

Source

pub fn invalid_config(message: &str, suggestion: &str) -> DataProfilerError

Create configuration error with specific suggestion

Source

pub fn invalid_config_with_source<E>( message: impl Into<String>, suggestion: impl Into<String>, original: E, ) -> DataProfilerError
where E: Error + Send + Sync + 'static,

Create a configuration error that retains original as its source.

Used by the TOML and glob conversions, where the underlying parser reports a position worth reaching programmatically.

Source

pub fn streaming_error(message: &str) -> DataProfilerError

Create streaming error with context

Source

pub fn streaming_with_suggestion( message: impl Into<String>, suggestion: impl Into<String>, ) -> DataProfilerError

Create a streaming error with an actionable suggestion and no source.

An empty suggestion means there is no remedy to offer the caller.

Source

pub fn streaming_with_source<E>( message: impl Into<String>, suggestion: impl Into<String>, original: E, ) -> DataProfilerError
where E: Error + Send + Sync + 'static,

Create a streaming error that retains original without changing its contextual message, suggestion, or streaming category.

Source

pub fn io_error(original: Error) -> DataProfilerError

Create an I/O error that retains original as its source.

Takes the error by value: std::io::Error is not cloneable, so a borrowed one could only ever be stringified, which is what this issue set out to stop. Use map_err(DataProfilerError::io_error) at call sites.

Source

pub fn io_message(message: &str) -> DataProfilerError

Create an I/O error from a message, for callers with no originating error to retain (a condition detected by dataprof itself rather than reported by the OS).

Source

pub fn json_parsing_error(original: &str) -> DataProfilerError

Create a JSON parsing error with no retained source.

Source

pub fn json_parsing_from<E>(original: E) -> DataProfilerError
where E: Error + Send + Sync + 'static,

Create a JSON parsing error that retains original as its source.

Source

pub fn csv_parsing_with_source<E>( message: impl Into<String>, suggestion: impl Into<String>, original: E, ) -> DataProfilerError
where E: Error + Send + Sync + 'static,

Create a CSV parsing error with a caller-supplied message and suggestion that still retains original as its source.

For callers whose suggestion is specific to their own context and so cannot come from DataProfilerError::csv_parsing’s message analysis.

Source

pub fn csv_structure( message: impl Into<String>, suggestion: impl Into<String>, ) -> DataProfilerError

Create a CSV parsing error for a structural problem the parser itself accepted, so there is no underlying error to keep as its source.

Source

pub fn json_parsing_with_source<E>( message: impl Into<String>, original: E, ) -> DataProfilerError
where E: Error + Send + Sync + 'static,

Create a JSON parsing error with a caller-supplied message that still retains original as its source.

Used where the message adds context the decoder does not have (a record position, a physical line number) and the decoder error is still worth keeping underneath it.

Source

pub fn arrow_with_source<E>( message: impl Into<String>, original: E, ) -> DataProfilerError
where E: Error + Send + Sync + 'static,

Create an Arrow error with a caller-supplied message that still retains original as its source.

Source

pub fn parquet_with_source<E>( message: impl Into<String>, original: E, ) -> DataProfilerError
where E: Error + Send + Sync + 'static,

Create a Parquet error with a caller-supplied message that still retains original as its source.

Source

pub fn io_with_source<E>( message: impl Into<String>, original: E, ) -> DataProfilerError
where E: Error + Send + Sync + 'static,

Create an I/O error with a caller-supplied message that still retains original as its source.

Source

pub fn arrow_error(message: &str) -> DataProfilerError

Create an Arrow error with no retained source.

Source

pub fn arrow_error_from<E>(original: E) -> DataProfilerError
where E: Error + Send + Sync + 'static,

Create an Arrow error that retains original as its source.

Source

pub fn parquet_error(message: &str) -> DataProfilerError

Create a Parquet error with no retained source.

Source

pub fn suggestion(&self) -> Option<String>

The actionable next step for this error, as structured context.

Suggestions live in the variants and the Display string, but callers that want to react programmatically (or render the hint separately from the message) should read it here rather than parse the formatted output.

Source

pub fn category(&self) -> &'static str

Get error category for logging/metrics

Trait Implementations§

Source§

impl Debug for DataProfilerError

Source§

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

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

impl Display for DataProfilerError

Source§

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

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

impl Error for DataProfilerError

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<ArrowError> for DataProfilerError

Available on crate feature arrow only.

Convert from arrow::error::ArrowError to DataProfilerError

Source§

fn from(err: ArrowError) -> DataProfilerError

Converts to this type from the input type.
Source§

impl From<Error> for DataProfilerError

Convert from anyhow::Error to DataProfilerError with context.

These conversions run where the source path/operation is not known, so they never fabricate one: a path is only ever attached by the call sites that hold it (see DataProfilerError::csv_parsing, map_io_error, and the facade’s existence check). Preserving the original message keeps the source diagnostic.

Source§

fn from(err: Error) -> DataProfilerError

Converts to this type from the input type.
Source§

impl From<Error> for DataProfilerError

Convert from std::io::Error to DataProfilerError.

Path-less by design: callers that know the file use map_io_error to produce a DataProfilerError::FileNotFound with the real path. Here we keep the OS message (which already names the condition) rather than guessing a path.

Source§

fn from(err: Error) -> DataProfilerError

Converts to this type from the input type.
Source§

impl From<Error> for DataProfilerError

Convert from csv::Error to DataProfilerError with enhanced context.

The source path is unknown at this boundary, so the suggestion is written without a filename rather than the misleading 'unknown' placeholder.

Source§

fn from(err: Error) -> DataProfilerError

Converts to this type from the input type.
Source§

impl From<Error> for DataProfilerError

Convert from serde_json::Error to DataProfilerError

Source§

fn from(err: Error) -> DataProfilerError

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

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

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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 = !

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

fn try_from(value: U) -> Result<T, !>

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

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more