Skip to main content

inferlab_proxy/
error.rs

1use std::fmt;
2
3/// Lifecycle/setup error for standing a built-in proxy up; per-request
4/// failures are [`crate::core::ProxyHttpError`].
5#[derive(Clone, Debug, Eq, PartialEq)]
6pub enum ProxyError {
7    Io { message: String },
8    ExternalTool { message: String },
9    Invalid { message: String },
10    Lifecycle { message: String },
11}
12
13impl fmt::Display for ProxyError {
14    fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
15        match self {
16            Self::Io { message }
17            | Self::ExternalTool { message }
18            | Self::Invalid { message }
19            | Self::Lifecycle { message } => formatter.write_str(message),
20        }
21    }
22}
23
24impl std::error::Error for ProxyError {}