brokaw/raw/
error.rs

1use std::net::TcpStream;
2
3/// Low level API Errors
4///
5/// These errors represent (e.g. I/O, deserialization, parsing, etc).
6/// For protocol level errors see [`crate::error::Error`]
7#[derive(Debug, thiserror::Error)]
8#[non_exhaustive]
9pub enum Error {
10    /// The connection encountered some sort of I/O error
11    #[error("IO {0}")]
12    Io(#[from] std::io::Error),
13    /// An error raised by the system's TLS implementation
14    #[error("TLS Error -- {0}")]
15    Tls(#[from] native_tls::Error),
16    /// The TLS Handshake has failed
17    #[error("TLS Handshake Error -- {0}")]
18    TlsHandshake(#[from] native_tls::HandshakeError<TcpStream>),
19    /// The server returned data that could not be parsed
20    ///
21    /// This likely indicates that either a bug in Brokaw's response parser,
22    /// data corruption, or an out of spec server.
23    ///
24    /// This could also occur if an unsupported compression mechanism is enabled.
25    #[error("Failed to parse response")]
26    Parse,
27}
28
29/// A Result returned by the low level API
30pub type Result<T> = std::result::Result<T, Error>;