[DEV-7133] Add AsgError::Cycle

We want a special error type when we detect cyclic dependencies.
master
Joseph Frazer 2020-03-16 12:50:41 -04:00
parent 7a4f6cf9f2
commit 59f194a46a
1 changed files with 5 additions and 0 deletions

View File

@ -238,6 +238,8 @@ pub enum AsgError {
/// The node was not expected in the current context
UnexpectedNode(String),
/// The graph has a cyclic dependency
Cycle(String),
}
impl std::fmt::Display for AsgError {
@ -252,6 +254,9 @@ impl std::fmt::Display for AsgError {
Self::UnexpectedNode(msg) => {
write!(fmt, "unexpected node: {}", msg)
}
Self::Cycle(msg) => {
write!(fmt, "Cyclic dependency detected: {}", msg)
}
}
}
}