1use alloc::string::String;
2use thiserror::Error;
3
4pub type Result<T> = core::result::Result<T, HttpUrlError>;
6
7#[derive(Error, Debug, Clone, PartialEq, Eq)]
9pub enum HttpUrlError {
10 #[error("URL is empty")]
12 EmptyUrl,
13
14 #[error("missing scheme (expected 'http' or 'https')")]
16 MissingScheme,
17
18 #[error("unsupported scheme: '{0}'")]
20 UnsupportedScheme(String),
21
22 #[error("missing host")]
24 MissingHost,
25
26 #[error("invalid port: '{0}'")]
28 InvalidPort(String),
29
30 #[error("port out of range: {0}")]
32 PortOutOfRange(u64),
33
34 #[error("invalid host: '{0}'")]
36 InvalidHost(String),
37
38 #[error("invalid percent-encoding: '{0}'")]
40 InvalidPercentEncoding(String),
41
42 #[error("unicode normalization error")]
44 UnicodeError,
45
46 #[error("builder validation error: {0}")]
48 BuilderValidation(String),
49}