Skip to main content

crabka_connect/
error.rs

1//! The error type shared by the connector SPI.
2
3/// Errors raised by [`Source`](crate::Source), [`Sink`](crate::Sink), and
4/// [`Converter`](crate::Converter) implementations.
5#[derive(Debug, thiserror::Error)]
6pub enum ConnectError {
7    /// An I/O failure talking to the external system (socket, file, …).
8    #[error("connect I/O error: {0}")]
9    Io(#[from] std::io::Error),
10
11    /// Serializing or deserializing a record payload failed. Wraps converter
12    /// failures, e.g. a schema-registry serde rejecting a value or a writer
13    /// schema not yet resolved.
14    #[error("conversion error: {0}")]
15    Convert(String),
16
17    /// A checkpoint could not be produced, or a [`SourceOffset`](crate::SourceOffset)
18    /// handed back to [`Source::seek`](crate::Source::seek) does not name a
19    /// position this source can resume from.
20    #[error("offset error: {0}")]
21    Offset(String),
22
23    /// A transactional [`Sink`](crate::Sink) operation failed (begin / commit /
24    /// abort), or transactional methods were driven against a sink that does
25    /// not support them.
26    #[error("transaction error: {0}")]
27    Transaction(String),
28
29    /// A backend error that does not map cleanly onto one of the structured
30    /// variants above.
31    #[error("connect backend error: {0}")]
32    Backend(String),
33}