//! Unified error set for csv_utils. //! //! `Error` is the union of every error any csv_utils parsing function //! may produce. Individual functions may declare narrower subsets //! (e.g. `Dialect.validate` returns only `error{InvalidDialect}`). //! Callers that want a single error set to handle should use this. const std = @import("std"); /// Parser-level error set (excluding propagated reader errors). const ParseError = error{ // --- Parser-detected malformed input ----------------------------- /// End-of-input was reached inside a quoted field. UnterminatedQuotedField, /// A quote character appeared in the middle of an unquoted field. UnexpectedQuote, /// A non-delimiter, non-newline byte appeared after the closing /// quote of a quoted field. UnexpectedByteAfterQuote, // --- Caller-buffer exhaustion ------------------------------------ /// A single field's decoded content would exceed the caller-provided /// field buffer. FieldTooLong, /// A row contained more fields than the row buffer can hold (for /// the bounded / fixed-buffer row iterator variants). RowTooWide, // --- Dialect / configuration ------------------------------------- /// The provided `Dialect` is internally inconsistent (e.g. /// delimiter and quote character are the same byte, or one of /// them is `\n`/`\r`). InvalidDialect, // --- Header tier -------------------------------------------------- /// A header lookup was attempted using a name that was not present /// in the header row. Reserved: current `get`-style APIs return /// optionals; this is for a possible future strict accessor. UnknownHeader, /// The header row contained duplicate names and the configured /// duplicate-header policy is strict. DuplicateHeader, /// A data row's field count differs from the header row's, and the /// configured row-width policy is strict. RowWidthMismatch, }; /// The unified csv_utils error set. Union of parser errors, allocator /// errors, and propagated `std.Io.Reader` errors. pub const Error = ParseError || std.mem.Allocator.Error || std.Io.Reader.Error;