use crate::PrefixMap;
use iri_s::error::IriSError;
use thiserror::Error;
#[derive(Debug, Error, Clone)]
pub enum PrefixMapError {
#[error(transparent)]
IriSError(#[from] IriSError),
#[error("Alias '{prefix}' not found in prefix map\nAvailable aliases: [{}]", prefixmap.aliases().cloned().collect::<Vec<_>>().join(", "))]
PrefixNotFound { prefix: String, prefixmap: PrefixMap },
#[error(transparent)]
FormatError(#[from] std::fmt::Error),
#[error("IO Error: {error}")]
IOError { error: String },
#[error("Alias '{prefix}' already exists in prefix map with value '{value}'")]
AliasAlreadyExists { prefix: String, value: String },
}
#[derive(Debug, Error, Clone)]
#[error("Cannot obtain IRI from prefixed name IriRef {prefix}:{local}")]
pub struct IriRefError {
pub prefix: String,
pub local: String,
}
#[derive(Debug, Error, Clone)]
pub enum DerefError {
#[error(transparent)]
IriSError(#[from] IriSError),
#[error("Error obtaining IRI for '{alias}:{local}': {error}")]
DerefPrefixMapError {
alias: String,
local: String,
error: Box<PrefixMapError>,
},
#[error("No prefix map to dereference prefixed name {prefix}{local}")]
NoPrefixMapPrefixedName { prefix: String, local: String },
#[error(transparent)]
UnderefError(#[from] IriRefError),
}