Files
orchid/src/error/unexpected_directory.rs
Lawrence Bethlenfalvy 86e520e8b8 September-october commit
- manual parser
- stl refinements
- all language constructs are now Send
2023-10-11 18:27:50 +01:00

29 lines
758 B
Rust

use std::sync::Arc;
use super::ProjectError;
use crate::{Interner, Location, VName};
/// Produced when a stage that deals specifically with code encounters
/// a path that refers to a directory
#[derive(Debug)]
pub struct UnexpectedDirectory {
/// Path to the offending collection
pub path: VName,
}
impl ProjectError for UnexpectedDirectory {
fn description(&self) -> &str {
"A stage that deals specifically with code encountered a path that refers \
to a directory"
}
fn one_position(&self) -> crate::Location {
Location::File(Arc::new(self.path.clone()))
}
fn message(&self) -> String {
format!(
"{} was expected to be a file but a directory was found",
Interner::extern_all(&self.path).join("/")
)
}
}