vector_core/source_sender/
errors.rs

1use std::fmt;
2
3use vector_buffers::topology::channel;
4
5#[derive(Clone, Copy, Debug, Eq, PartialEq)]
6pub enum SendError {
7    Timeout,
8    Closed,
9}
10
11impl<T> From<channel::SendError<T>> for SendError {
12    fn from(_: channel::SendError<T>) -> Self {
13        Self::Closed
14    }
15}
16
17impl fmt::Display for SendError {
18    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
19        match self {
20            Self::Timeout => f.write_str("Send timed out."),
21            Self::Closed => f.write_str("Sender is closed."),
22        }
23    }
24}
25
26impl std::error::Error for SendError {}