use std::{path::PathBuf, sync::Arc};
use thiserror::Error;
use crate::ir::{Address, Span};
#[derive(Debug, Error)]
#[non_exhaustive]
pub enum GraphError {
#[error("module source `{module_source}` referenced from {site:?} is not resolvable")]
UnresolvableModuleSource {
module_source: Arc<str>,
site: Box<Span>,
},
#[error("module recursion exceeded depth {limit} at {site:?}")]
DepthExceeded {
limit: u32,
site: Box<Span>,
},
#[error("address collision: {0}")]
AddressCollision(Address),
#[error("path safety: {path:?}: {reason}")]
PathSafety {
path: PathBuf,
reason: Arc<str>,
},
}