aboutsummaryrefslogtreecommitdiff
path: root/src/error.rs
blob: e37a02f88659413e03937b48ec0c13d6996ae4fa (plain)
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
#![warn(clippy::pedantic)]

use super::context::Context;

#[derive(Debug, Clone, thiserror::Error, PartialEq)]
pub enum Error {
    #[error("URI contains non-UTF8 sequences")]
    CannotExpressAsUtf8(#[from] std::string::FromUtf8Error),

    #[error("scheme expected but missing")]
    EmptyScheme,

    #[error("illegal character in {0}")]
    IllegalCharacter(Context),

    #[error("illegal percent encoding")]
    IllegalPercentEncoding,

    #[error("illegal port number")]
    IllegalPortNumber(#[source] std::num::ParseIntError),

    #[error("octet group expected")]
    InvalidDecimalOctet,

    #[error("too few address parts")]
    TooFewAddressParts,

    #[error("too many address parts")]
    TooManyAddressParts,

    #[error("too many digits in IPv6 address part")]
    TooManyDigits,

    #[error("too many double-colons in IPv6 address")]
    TooManyDoubleColons,

    #[error("truncated host")]
    TruncatedHost,
}