ds_event_stream_rs_sdk/producer/
error.rs

1//! Producer error module.
2//!
3//! This module contains error types specific to message production operations.
4
5use thiserror::Error;
6
7// region: --> ProducerError
8
9/// Errors that can occur during message production operations.
10///
11/// This enum covers all possible errors when creating producers or sending messages,
12/// including Kafka connection issues, JSON serialization problems, and configuration errors.
13#[derive(Error, Debug)]
14pub enum ProducerError {
15    /// Kafka client or operation errors
16    #[error("Kafka error: {0}")]
17    Kafka(#[from] rdkafka::error::KafkaError),
18
19    /// JSON serialization/deserialization errors
20    #[error("JSON error: {0}")]
21    Json(#[from] serde_json::Error),
22
23    /// Errors from utility operations (bootstrap servers, etc.)
24    #[error("Utils error: {0}")]
25    Utils(#[from] crate::utils::error::UtilsError),
26}
27
28// endregion: --> ProducerError