use ifc_model::EntityId;
use thiserror::Error;
#[derive(Debug, Clone, PartialEq, Error)]
#[non_exhaustive]
pub enum ControlError {
#[error("expected {expected}, found {actual}")]
WrongEntityType {
expected: &'static str,
actual: String,
},
#[error("{entity} {id} is missing {attribute}")]
MissingAttribute {
entity: &'static str,
id: EntityId,
attribute: &'static str,
},
#[error("entity {id} does not exist")]
UnknownEntity {
id: EntityId,
},
#[error("cannot author {entity}.{attribute}: {value}")]
AuthoringInvalid {
entity: &'static str,
attribute: &'static str,
value: String,
},
#[error("{schema} does not declare {entity}")]
UnsupportedEntity {
schema: String,
entity: &'static str,
},
}
pub type ControlResult<T> = Result<T, ControlError>;