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
use thiserror::Error;

pub type Result<T, E = LiftbridgeError> = core::result::Result<T, E>;

#[derive(Error, Debug)]
pub enum LiftbridgeError {
    #[error(transparent)]
    TransportError(#[from] tonic::transport::Error),
    #[error(transparent)]
    GrpcError(#[from] tonic::Status),
    #[error("Stream already exists")]
    StreamExists,
    #[error("Stream does not exist")]
    NoSuchStream,
    #[error("Stream partition does not exist")]
    NoSuchPartition,
    #[error("Stream has been deleted")]
    StreamDeleted,
    #[error("Stream partition has been paused")]
    PartitionPaused,
    #[error("Publish ack timeout")]
    AckTimeout,
    #[error("Can't connect to any of the specified brokers")]
    BrokersUnavailable,
    #[error("No known leader for partition")]
    NoLeader,
    #[error("Unable to subcribe")]
    UnableToSubscribe,
}