better_url/errors/host/
mod.rs1use thiserror::Error;
4
5use crate::prelude::*;
6
7mod domain; pub use domain::*;
8
9mod either ; pub use either ::*;
10mod file ; pub use file ::*;
11mod special_not_file; pub use special_not_file::*;
12mod non_special ; pub use non_special ::*;
13
14#[derive(Debug, Error)]
16#[error("Failed to parse an IPv4 host.")]
17pub struct InvalidIpv4Host;
18
19#[derive(Debug, Error)]
21#[error("Failed to parse an IPv6 host.")]
22pub struct InvalidIpv6Host;
23
24#[derive(Debug, Error)]
26#[error("Failed to parse an opaque host.")]
27pub struct InvalidOpaqueHost;
28
29#[derive(Debug, Error)]
31#[error("Failed to parse an empty host.")]
32pub struct InvalidEmptyHost;
33
34#[derive(Debug, Error)]
36#[error("Failed to get a host.")]
37pub struct NoHost;
38
39#[derive(Debug, Error)]
41#[error("Failed to get a domain.")]
42pub struct NoDomain;
43
44#[derive(Debug, Error)]
46#[error("Attempted to set a URL that can't have a host to have a host.")]
47pub struct CantHaveHost;
48
49#[derive(Debug, Error)]
51pub enum SetHostError {
52 #[error(transparent)] InvalidHost (#[from] InvalidHost ),
53 #[error(transparent)] SetDomainError(#[from] SetDomainError),
54 #[error(transparent)] NoDomain (#[from] NoDomain ),
55 #[error(transparent)] CantBeNone (#[from] CantBeNone ),
56 #[error(transparent)] CantBeEmpty (#[from] CantBeEmpty ),
57 #[error(transparent)] CantHaveHost (#[from] CantHaveHost ),
58 #[error(transparent)] TooLong (#[from] TooLong ),
59}