Skip to main content

Module error_display

Module error_display 

Source
Expand description

User-facing error message formatting.

Uses typed error matching (PolarsError variants, io::ErrorKind) rather than string parsing to produce actionable, implementation-agnostic messages.

Structs§

ConversionFailure
Values that would not convert, from a strict CAST or a STRPTIME, as the failed run reported them: Polars counts the failures in the batch it was converting and quotes a few.
FileError
An error reading a file, said as every reader error is: "<path>": <what went wrong>. <what to do>. (file_message).
HttpGone
An HTTP(S) file a request settled cannot be had.

Enums§

ErrorKindForPython
Classification for consumers (e.g. Python binding) that map to native exception types. Keeps error-handling logic in one place instead of duplicating in each binding.

Functions§

conversion_failure
The conversion that failed, if that is what err is.
error_for_python
Classify a report and return a kind plus user-facing message. Used by the Python binding to raise FileNotFoundError, PermissionDenied, or RuntimeError without duplicating chain-walk logic.
file_message
what went wrong reading path, in the one shape reader errors take: "<path>": <what went wrong>. <what to do>. Sentence case, its first line ended with a full stop, the file named once.
held_by_another_program
Whether err is Windows refusing a file another program holds: a sharing violation (32), as from a spreadsheet app with the workbook open, or a locked region (33). Polars rewraps an open’s error with the path in its text, keeping the OS’s words but not the code, so the text is read too. Off Windows those codes mean something else.
http_gone
err as HttpGone when it settles that url cannot be had: the file is not there, or no server answered. None for what an open might still get past, such as a refused HEAD or a server error.
http_message
What an HTTP request for url came to, when it failed: the server’s answer, or that there was none, naming the host either way.
in_file
err, from reading path, named by it (FileError) unless it already is.
located_message
file_message, with the line and column the problem is at, when it is at one place: "spec.toml":3:7: <what went wrong>. Without a path, the location and the sentence alone.
named_by_source
message with file, a temporary copy datui made, called source: what the user opened. A download or a decompressed CSV is read from a temp path the user never typed, and Polars names the file it was reading.
sentence
what as a sentence: its first letter capitalized and its first line ended with a full stop. The lines after it are kept as they are.
sql_error_message
A SQL error as the query prompt shows it: a failed conversion in datui’s words, anything else as Polars says it.
starts_with_a_key
Whether what starts with a key, a path or a name rather than a word: its first word followed by : (type: expected …), or holding ., _, =, a digit, a quote or a backtick (tags.nine, "day"). sentence leaves it as written.
store_message
What an object store said about a file in it: a missing object, refused access, or the store’s own words, each with what to check.
user_message_from_io
Format an io::Error as a user-facing message by matching on ErrorKind.
user_message_from_polars
Format a PolarsError as a user-facing message by matching on its variant.
user_message_from_report
Format a color_eyre Report by downcasting to known error types. Walks the cause chain to find PolarsError or io::Error.