Skip to main content
Everything fallible returns better_duck_core::error::Result<T> — an alias for Result<T, better_duck_core::error::Error> (both re-exported at the crate root). Error is #[non_exhaustive], so always match with a _ arm.

The Error enum

Error implements std::error::Error (with source()), Display, and a partial PartialEq.

EngineError — DuckDB’s classification

EngineError { kind: EngineErrorKind, message: Option<String> } is fully owned — every field is copied out of DuckDB memory when built, so it stays valid after the handle it came from (and the connection) are gone. EngineErrorKind mirrors duckdb_error_type and is #[non_exhaustive]:
  • Known kinds map 1:1 — Invalid, OutOfRange, Conversion, UnknownType, Decimal, MismatchType, DivideByZero, ObjectSize, InvalidType, Serialization, Transaction, NotImplemented, Expression, Catalog, Parser, Planner, Scheduler, Executor, Constraint, Index, Stat, Connection, Syntax, Settings, Binder, Network, Optimizer, NullPointer, Io, Interrupt, Fatal, Internal, InvalidInput, OutOfMemory, Permission, ParameterNotResolved, ParameterNotAllowed, Dependency, Http, MissingExtension, Autoload, Sequence, InvalidConfiguration. The full set is EngineErrorKind::KNOWN.
  • Unknown(raw) preserves a classification a future DuckDB adds — nothing is lost across upgrades.
  • Unavailable is an explicit absence: the originating API exposes only a status code and a message, with no typed classification. The driver never invents a kind by parsing message text.
EngineErrorKind::from_raw / to_raw round-trip the raw code; KNOWN lists every mapped kind; EngineError::unavailable(message) builds the Unavailable form.

Conversion errors

DuckDBConversionError (inside Error::ConversionError) classifies a value conversion failure:

OwnedValue

better_duck_core::OwnedValue (with IntervalParts) is a standalone, owned DuckDB value for introspection — built from a DuckValue via to_owned_value(). It exposes SQL-NULL checking, SQL string rendering, and STRUCT child access, outliving the handle it came from. Reach for it when you need DuckDB’s own view of a value rather than the Rust-side enum.

See also