pub enum Error {
Connection(ConnectionError),
Protocol(ProtocolError),
Kafka(KafkaCode),
Config(String),
Consumer(ConsumerError),
TopicPartitionError {
topic_name: String,
partition_id: i32,
error_code: KafkaCode,
},
BrokerRequestError {
broker: String,
api_key: &'static str,
source: Box<Self>,
},
}Expand description
The crate’s primary error type, encompassing network, protocol, server-side and client-side errors.
Variants§
Connection(ConnectionError)
Wrapper for connection-level errors.
Protocol(ProtocolError)
Wrapper for protocol encoding/decoding/version negotiation errors.
Kafka(KafkaCode)
Represents an error code returned by a Kafka broker.
Config(String)
Configuration-related error with a human message.
Consumer(ConsumerError)
Errors arising from the consumer high-level API.
TopicPartitionError
Error contextualized to a specific topic and partition.
Fields
BrokerRequestError
Error from a broker request which preserves broker context for debugging.
Implementations§
Source§impl Error
impl Error
Sourcepub fn with_broker_context(
self,
broker: impl Into<String>,
api_key: &'static str,
) -> Self
pub fn with_broker_context( self, broker: impl Into<String>, api_key: &'static str, ) -> Self
Wraps this error with broker request context (broker host and API key name).
Sourcepub fn is_retriable(&self) -> bool
pub fn is_retriable(&self) -> bool
Returns true if this error is likely transient and can be resolved by retrying.
Sourcepub fn is_connection_error(&self) -> bool
pub fn is_connection_error(&self) -> bool
Returns true if this error originates from the connection/network layer.
Sourcepub fn is_protocol_error(&self) -> bool
pub fn is_protocol_error(&self) -> bool
Returns true if this error originates from the protocol layer.
Sourcepub fn is_consumer_error(&self) -> bool
pub fn is_consumer_error(&self) -> bool
Returns true if this error originates from the consumer layer.
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()