better_url/errors/host/
domain.rs1use thiserror::Error;
4
5use crate::prelude::*;
6
7#[derive(Debug, Error)]
9#[error("Attempted to parse invalid Punycode.")]
10pub struct InvalidPunycode;
11
12#[derive(Debug, Error)]
14#[error("Attempted to parse an invalid DomainSegment.")]
15pub struct InvalidDomainSegment;
16
17#[derive(Debug, Error)]
19#[error("Attempted to parse an invalid DomainSegments.")]
20pub struct InvalidDomainSegments;
21
22#[derive(Debug, Error)]
24#[error("Attempted to parse an invalid DomainHost.")]
25pub struct InvalidDomainHost;
26
27impl From<InvalidDomainSegment > for InvalidDomainSegments {fn from(_: InvalidDomainSegment ) -> Self {Self}}
28impl From<InvalidDomainSegment > for InvalidDomainHost {fn from(_: InvalidDomainSegment ) -> Self {Self}}
29impl From<InvalidDomainSegments> for InvalidDomainHost {fn from(_: InvalidDomainSegments) -> Self {Self}}
30
31#[derive(Debug, Error)]
33#[error("Attempted to end a domain in a number.")]
34pub struct CantEndInANumber;
35
36#[derive(Debug, Error)]
38#[error("Attempted to end a non-FQDN DomainHost in an empty segment.")]
39pub struct NonFqdnCantEndInEmpty;
40
41#[derive(Debug, Error)]
43pub enum SetDomainError {
44 #[error(transparent)] InvalidDomainSegments(#[from] InvalidDomainSegments),
45 #[error(transparent)] TooLong (#[from] TooLong ),
46 #[error(transparent)] InsertNotFound (#[from] InsertNotFound ),
47 #[error(transparent)] RangeNotFound (#[from] RangeNotFound ),
48 #[error(transparent)] CantEndInANumber (#[from] CantEndInANumber ),
49 #[error(transparent)] NonFqdnCantEndInEmpty(#[from] NonFqdnCantEndInEmpty),
50 #[error(transparent)] InvalidDomainSegment (#[from] InvalidDomainSegment ),
51 #[error(transparent)] CantBeEmpty (#[from] CantBeEmpty ),
52 #[error(transparent)] InvalidDomainHost (#[from] InvalidDomainHost ),
53}