1use thiserror::Error;
4
5use crate::prelude::*;
6
7#[derive(Debug, Error)]
9pub enum InvalidUrl {
10 #[error(transparent)] InvalidScheme (#[from] InvalidScheme ),
11 #[error(transparent)] InvalidFileHost (#[from] InvalidFileHost ),
12 #[error(transparent)] InvalidSpecialNotFileHost(#[from] InvalidSpecialNotFileHost),
13 #[error(transparent)] InvalidNonSpecialHost (#[from] InvalidNonSpecialHost ),
14 #[error(transparent)] InvalidPort (#[from] InvalidPort ),
15 #[error(transparent)] TooLong (#[from] TooLong ),
16
17 #[error("Attempted to parse a URL with no scheme.")]
19 MissingScheme,
20 #[error("Attempted to parse a URL with an empty host and a userinfo and/or port.")]
22 EmptyHostCantHaveUserinfoOrPort,
23}
24
25#[derive(Debug, Error)]
27pub enum InvalidJoin {
28 #[error(transparent)] TooLong (#[from] TooLong ),
29 #[error(transparent)] InvalidUrl (#[from] InvalidUrl ),
30 #[error(transparent)] InvalidScheme (#[from] InvalidScheme ),
31 #[error(transparent)] CannotBeABase (#[from] CannotBeABase ),
32 #[error("Attempted to join a non-relative URL with something other than a fragment or a whole URL.")]
34 MissingSchemeNonRelativeUrl,
35}
36
37#[derive(Debug, Error)]
39#[error("Attempted to join more than the fragment on a cannot-be-a-base URL.")]
40pub struct CannotBeABase;