1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
//!
//! IPP error
//!
use std::io;

use http::uri::InvalidUri;

use crate::{model::StatusCode, parser::IppParseError};

/// IPP error
#[allow(clippy::large_enum_variant)]
#[derive(Debug, thiserror::Error)]
pub enum IppError {
    #[error(transparent)]
    /// HTTP protocol error
    HttpError(#[from] http::Error),

    #[error(transparent)]
    #[cfg(feature = "async-client")]
    /// Client error
    AsyncClientError(#[from] reqwest::Error),

    #[error("HTTP request error: {0}")]
    /// HTTP request error
    RequestError(u16),

    #[error(transparent)]
    /// Network or file I/O error
    IoError(#[from] io::Error),

    #[error("IPP status error: {0}")]
    /// IPP status error
    StatusError(StatusCode),

    #[error("Printer not ready")]
    PrinterNotReady,

    #[error(transparent)]
    /// Parsing error
    ParseError(#[from] IppParseError),

    #[error("Missing attribute in response")]
    /// Missing attribute in response
    MissingAttribute,

    #[error("Invalid attribute type")]
    /// Invalid attribute type
    InvalidAttributeType,

    #[error(transparent)]
    /// Invalid URI
    InvalidUri(#[from] InvalidUri),

    #[error(transparent)]
    #[cfg(feature = "client")]
    /// Client error
    ClientError(#[from] ureq::Error),

    #[error(transparent)]
    #[cfg(any(feature = "async-client-tls", feature = "client-tls"))]
    /// TLS error
    TlsError(#[from] native_tls::Error),
}