1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
use std::io::Error as IoError;
use thiserror::Error;

use fluvio_socket::FlvSocketError;
use fluvio_sc_schema::ApiError;
use crate::config::ConfigError;

/// Possible errors that may arise when using Fluvio
#[derive(Error, Debug)]
pub enum FluvioError {
    #[error("Topic not found: {0}")]
    TopicNotFound(String),
    #[error("Partition not found: {0}-{1}")]
    PartitionNotFound(String, i32),
    #[error(transparent)]
    IoError {
        #[from]
        source: IoError,
    },
    #[error("Fluvio socket error")]
    FlvSocketError {
        #[from]
        source: FlvSocketError,
    },
    #[error("Fluvio SC schema error")]
    ApiError {
        #[from]
        source: ApiError,
    },
    #[error("Fluvio config error")]
    ConfigError {
        #[from]
        source: ConfigError,
    },
    #[error("Attempted to create negative offset: {0}")]
    NegativeOffset(i64),
    #[error("Unknown error: {0}")]
    Other(String),
}