apt_transport/error.rs
1/// Error type for all APT transport operations.
2#[derive(Debug, thiserror::Error)]
3pub enum Error {
4 /// An I/O error occurred.
5 #[error("I/O error: {0}")]
6 Io(#[from] std::io::Error),
7
8 /// An unexpected end of stream was encountered.
9 #[error("message parser: unexpected end of stream")]
10 UnexpectedEof,
11
12 /// Too much data was encountered.
13 #[error("message parser: too much data encountered")]
14 MessageTooMuchData,
15
16 /// A message parsing error occurred.
17 #[error("message parser: {0}")]
18 MessageParse(String),
19
20 /// A required header was not found.
21 ///
22 /// When this error is returned by the higher-level abstractions (namely
23 /// during URI requests), the APT server will have already been informed
24 /// of the failure.
25 #[error("required header not found: {0}")]
26 HeaderNotFound(String),
27
28 /// An attempt to change the input/output streams after initialization
29 /// was made.
30 #[error("cannot change input/output streams after initialization")]
31 StreamAlreadyInitialized,
32
33 /// APT sent a message type we don't expect nor support.
34 #[error("unexpected message type from APT: {0:?}")]
35 UnexpectedMessageType(crate::message::MessageType, crate::message::Message),
36}