nntp_proxy/protocol/article/
error.rs1#[derive(Debug, Clone, PartialEq, Eq, thiserror::Error)]
5pub enum ParseError {
6 #[error("Invalid status code: {0}")]
7 InvalidStatusCode(u16),
8
9 #[error("Missing blank line separator between headers and body")]
10 MissingSeparator,
11
12 #[error("Invalid header: {0}")]
13 InvalidHeader(String),
14
15 #[error("HEAD response should not contain body")]
16 UnexpectedBody,
17
18 #[error("Invalid yenc: {0}")]
19 InvalidYenc(String),
20
21 #[error("Buffer too short to contain valid response")]
22 BufferTooShort,
23
24 #[error("Invalid message-ID: {0}")]
25 InvalidMessageId(String),
26}
27
28impl From<crate::types::validated::ValidationError> for ParseError {
30 fn from(err: crate::types::validated::ValidationError) -> Self {
31 Self::InvalidMessageId(err.to_string())
32 }
33}