Skip to main content

Error

Enum Error 

Source
#[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
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future 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

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: i32

X-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).

§message: String

Cleaned message body, stripped of the Code: N., DB::Exception: prefix, exception-name parens, and (version ...) suffix.

§stack_trace: Option<String>

Server-side stack trace if Stack trace: was present in the body.

§

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)

Available on crate feature 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

Source

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.

Source

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 Debug for Error

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for Error

Source§

fn fmt(&self, __formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Error for Error

Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0:

use the Display impl or to_string()

1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl Error for Error

Source§

fn custom<T: Display>(msg: T) -> Self

Used when a Serialize implementation encounters any error while serializing a type. Read more
Source§

impl Error for Error

Source§

fn custom<T: Display>(msg: T) -> Self

Raised when there is general error when deserializing a type. Read more
Source§

fn invalid_type(unexp: Unexpected<'_>, exp: &dyn Expected) -> Self

Raised when a Deserialize receives a type different from what it was expecting. Read more
Source§

fn invalid_value(unexp: Unexpected<'_>, exp: &dyn Expected) -> Self

Raised when a Deserialize receives a value of the right type but that is wrong for some other reason. Read more
Source§

fn invalid_length(len: usize, exp: &dyn Expected) -> Self

Raised when deserializing a sequence or map and the input data contains too many or too few elements. Read more
Source§

fn unknown_variant(variant: &str, expected: &'static [&'static str]) -> Self

Raised when a Deserialize enum type received a variant with an unrecognized name.
Source§

fn unknown_field(field: &str, expected: &'static [&'static str]) -> Self

Raised when a Deserialize struct type received a field with an unrecognized name.
Source§

fn missing_field(field: &'static str) -> Self

Raised when a 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

Raised when a Deserialize struct type received more than one of the same field.
Source§

impl From<DynamicError> for Error

Source§

fn from(source: DynamicError) -> Self

Converts to this type from the input type.
Source§

impl From<Error> for Error

Source§

fn from(error: Error) -> Self

Converts to this type from the input type.
Source§

impl From<Error> for Error

Source§

fn from(error: Error) -> Self

Converts to this type from the input type.
Source§

impl From<Error> for Error

Source§

fn from(error: Error) -> Self

Converts to this type from the input type.
Source§

impl From<Utf8Error> for Error

Source§

fn from(source: Utf8Error) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

§

impl !RefUnwindSafe for Error

§

impl !UnwindSafe for Error

§

impl Freeze for Error

§

impl Send for Error

§

impl Sync for Error

§

impl Unpin for Error

§

impl UnsafeUnpin for Error

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<U> As for U

Source§

fn as_<T>(self) -> T
where T: CastFrom<U>, U: Sized,

Casts self to type T. The semantics of numeric casting with the as operator are followed, so <T as As>::as_::<U> can be used in the same way as T as U for numeric conversions. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more