#[cfg(not(feature = "std"))]
use alloc::string::String;
use strum::{EnumIs, EnumTryAs};
use thiserror::Error;
use url::ParseError as UrlError;
#[derive(Debug, Error, EnumIs, EnumTryAs)]
#[allow(missing_docs)] pub enum Error {
#[error("An error occurred trying to parse a name; error: {0}")]
Name(#[from] NameParseError),
#[error("An error occurred parsing an IRI; error: {0}")]
Url(#[from] UrlError),
}
#[derive(Debug, Error, EnumIs, EnumTryAs)]
#[allow(missing_docs)] pub enum NameParseError {
#[error("An empty string was passed, this is not a valid name")]
EmptyString,
#[error(
"The parser encountered a character which is not valid according to its grammar; input: \"{0}\""
)]
InvalidCharacter(String),
#[error("The parser encountered more `':'` separator characters than expected; input: \"{0}\"")]
TooManySeparators(String),
#[error(
"The Namespace string is missing a `':'` separator character at the end; input: \"{0}\""
)]
MissingSeparator(String),
}