diff options
Diffstat (limited to 'src/error.rs')
-rw-r--r-- | src/error.rs | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/src/error.rs b/src/error.rs new file mode 100644 index 0000000..e37a02f --- /dev/null +++ b/src/error.rs @@ -0,0 +1,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, +} + |