#[non_exhaustive]pub enum Error {
Show 23 variants
InvalidParams(Box<dyn StdError + Send + Sync>),
Network(Box<dyn StdError + Send + Sync>),
Compression(Box<dyn StdError + Send + Sync>),
Decompression(Box<dyn StdError + Send + Sync>),
RowNotFound,
SequenceMustHaveLength,
DeserializeAnyNotSupported,
NotEnoughData,
InvalidUtf8Encoding(Utf8Error),
InvalidTagEncoding(usize),
VariantDiscriminatorIsOutOfBound(usize),
Custom(String),
WorkerExited,
ServerException {
code: i32,
name: Option<String>,
message: String,
stack_trace: Option<String>,
},
BadResponse(String),
Transient(String),
Connect(String),
TimedOut,
InvalidColumnsHeader(Box<dyn StdError + Send + Sync>),
SchemaMismatch(String),
Unsupported(String),
Dynamic(DynamicError),
Other(Box<dyn StdError + Send + Sync>),
}Expand description
Represents all possible errors.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
InvalidParams(Box<dyn StdError + Send + Sync>)
Network(Box<dyn StdError + Send + Sync>)
Compression(Box<dyn StdError + Send + Sync>)
Decompression(Box<dyn StdError + Send + Sync>)
RowNotFound
SequenceMustHaveLength
DeserializeAnyNotSupported
NotEnoughData
InvalidUtf8Encoding(Utf8Error)
InvalidTagEncoding(usize)
VariantDiscriminatorIsOutOfBound(usize)
Custom(String)
WorkerExited
Background worker task exited; the inserter is no longer accepting commands. Terminal: construct a fresh inserter, don’t retry the same handle.
ServerException
Structured server-side exception parsed from the response.
Preferred over Error::BadResponse when the server returned
a recognisable Code: NNN. DB::Exception: ... body. Callers
can match on code for typed handling and use
Error::is_retriable for conservative retry classification.
Fields
code: i32X-ClickHouse-Exception-Code from the response header.
Signed int on the wire (cpp-client + server source);
codes are small positives in practice.
name: Option<String>Exception name extracted from (UPPERCASE_NAME) near
the end of the message. None when the parser couldn’t
recognise it (older CH versions, custom error paths).
BadResponse(String)
Transient(String)
A transport-level failure that a fresh attempt may not hit – a pool-acquire timeout, a closed pool, a hook failure. Typed so retry classification does not have to match on message text.
Connect(String)
A connection could not be opened: an unresolvable host, a host
that resolved to no addresses, an empty endpoint list. Typed for
the same reason as Error::Transient.
TimedOut
InvalidColumnsHeader(Box<dyn StdError + Send + Sync>)
SchemaMismatch(String)
Unsupported(String)
Dynamic(DynamicError)
dynamic only.A dynamic-insert failure, kept typed so a caller can tell a stale schema (re-fetch and retry) from a permanent rejection.
Other(Box<dyn StdError + Send + Sync>)
Implementations§
Source§impl Error
impl Error
Sourcepub fn is_retriable(&self) -> bool
pub fn is_retriable(&self) -> bool
Conservative retriability classification.
Returns true for errors that might succeed on retry –
transport-level (Network, TimedOut, Transient, Connect),
a known set of transient server-side codes, and the dynamic-insert
failures that clear once the schema is re-read.
Returns false for everything else, including unknown server codes:
a caller wanting a more aggressive retry should match on the variant.
The code table is is_retriable_code.
Sourcepub fn is_retriable_code(code: i32) -> bool
pub fn is_retriable_code(code: i32) -> bool
ClickHouse error codes considered transient for retry. See
src/Common/ErrorCodes.cpp upstream for the canonical list.
Conservative – false negatives are expected, false positives
should be rare. Each entry names its upstream macro.
Trait Implementations§
Source§impl Error for Error
impl Error for Error
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Source§impl Error for Error
impl Error for Error
Source§fn custom<T: Display>(msg: T) -> Self
fn custom<T: Display>(msg: T) -> Self
Source§fn invalid_type(unexp: Unexpected<'_>, exp: &dyn Expected) -> Self
fn invalid_type(unexp: Unexpected<'_>, exp: &dyn Expected) -> Self
Deserialize receives a type different from what it was
expecting. Read moreSource§fn invalid_value(unexp: Unexpected<'_>, exp: &dyn Expected) -> Self
fn invalid_value(unexp: Unexpected<'_>, exp: &dyn Expected) -> Self
Deserialize receives a value of the right type but that
is wrong for some other reason. Read moreSource§fn invalid_length(len: usize, exp: &dyn Expected) -> Self
fn invalid_length(len: usize, exp: &dyn Expected) -> Self
Source§fn unknown_variant(variant: &str, expected: &'static [&'static str]) -> Self
fn unknown_variant(variant: &str, expected: &'static [&'static str]) -> Self
Deserialize enum type received a variant with an
unrecognized name.Source§fn unknown_field(field: &str, expected: &'static [&'static str]) -> Self
fn unknown_field(field: &str, expected: &'static [&'static str]) -> Self
Deserialize struct type received a field with an
unrecognized name.Source§fn missing_field(field: &'static str) -> Self
fn missing_field(field: &'static str) -> Self
Deserialize struct type expected to receive a required
field with a particular name but that field was not present in the
input.Source§fn duplicate_field(field: &'static str) -> Self
fn duplicate_field(field: &'static str) -> Self
Deserialize struct type received more than one of the
same field.