#[non_exhaustive]pub enum ErrorCode {
Show 14 variants
Parser,
Syntax,
Binder,
Catalog,
Conversion,
OutOfRange,
InvalidInput,
OutOfMemory,
Io,
NotImplemented,
Constraint,
Transaction,
Interrupt,
Internal,
}Expand description
What kind of thing went wrong.
These are stable and they are part of the public interface, because a client that retries on one class of failure and gives up on another has to be able to tell them apart without reading the message. Adding a variant is a compatible change and renaming one is not.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Parser
The text is not SQL.
Syntax
The text is SQL and a value in it is not one the statement can take.
DuckDB’s own line between this and ErrorCode::Parser is not one anybody would draw
twice, and it is on the wire, so it is here: SET threads=0 is a syntax error there and a
syntax error here.
Binder
The text is SQL and it does not mean anything, for example a column that is not in scope.
Catalog
A named object is missing, or one that should be missing is not.
Conversion
A value will not convert to the type it is being asked for.
OutOfRange
A value is outside what its type can hold.
InvalidInput
An argument is wrong in a way that is not a type error, for example a negative length.
OutOfMemory
An allocation failed or a memory limit was reached. An error, never an abort.
Io
The filesystem, the network or the object store said no.
NotImplemented
It is in the plan and it is not built yet.
Constraint
A primary key, unique, not null or check constraint was violated.
Transaction
A conflict, an abort, or a statement issued outside a transaction that needs one.
Interrupt
The query was cancelled. Cooperative, checked at morsel boundaries.
Internal
An invariant this code is responsible for does not hold. Always a bug here, never in the query.
Implementations§
Source§impl ErrorCode
impl ErrorCode
Sourcepub const fn duckdb_name(self) -> &'static str
pub const fn duckdb_name(self) -> &'static str
The prefix DuckDB puts on a message with this code.
Compatibility obligation from spec/12-duckdb-compat.md section 12.5: a great many tests
in the wild assert on the exact text of an error, so the prefix is DuckDB’s spelling
including the parts that look like typos. Not implemented Error really is capitalised
that way upstream, and INTERNAL Error really is shouted.
Sourcepub const fn is_user_error(self) -> bool
pub const fn is_user_error(self) -> bool
Whether an error with this code says something about the query rather than about us.
Used by the fuzzing harness in spec/16-testing.md section 16.4, which treats a rejected
query as a normal outcome and an internal error as a finding.