Skip to content

Commit

Permalink
rename ToplevelError to GraphError (#86)
Browse files Browse the repository at this point in the history
  • Loading branch information
molpopgen authored May 30, 2022
1 parent 1405ce8 commit 8c0539e
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ pub enum DemesError {
#[error("{0:?}")]
EpochError(String),
#[error("{0:?}")]
TopLevelError(String),
GraphError(String),
#[error("generation time must be > 0.0, got: {0:?}")]
GenerationTimeError(f64),
#[error("{0:?}")]
Expand Down
6 changes: 3 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
//! - https://doi.org/10.1371/journal.pgen.1000695
//! time_units: years
//! generation_time: 25
//!
//!
//! demes:
//! - name: ancestral
//! description: Equilibrium/root population
Expand Down Expand Up @@ -41,7 +41,7 @@
//! ancestors: [OOA]
//! epochs:
//! - {start_size: 510, end_size: 54090}
//!
//!
//! migrations:
//! - {demes: [YRI, OOA], rate: 25e-5}
//! - {demes: [YRI, CEU], rate: 3e-5}
Expand All @@ -61,7 +61,7 @@
//! assert_eq!(graph, roundtripped_graph);
//! }
//!
//!
//!
//!for deme in graph.demes() {
//! println!("{} {} {} {} {}",
//! deme.name(),
Expand Down
6 changes: 3 additions & 3 deletions src/specification.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ impl TryFrom<TimeTrampoline> for Time {
if &string == "Infinity" {
Ok(Self(f64::INFINITY))
} else {
Err(DemesError::TopLevelError(string))
Err(DemesError::GraphError(string))
}
}
// Fall back to valid YAML representations
Expand Down Expand Up @@ -2049,7 +2049,7 @@ impl Graph {
}

if !matches!(&self.time_units, TimeUnits::GENERATIONS) && self.generation_time.is_none() {
return Err(DemesError::TopLevelError(
return Err(DemesError::GraphError(
"missing generation_time".to_string(),
));
}
Expand All @@ -2063,7 +2063,7 @@ impl Graph {
match self.generation_time {
Some(value) => {
if !value.0.eq(&1.0) {
return Err(DemesError::TopLevelError(
return Err(DemesError::GraphError(
"time units are generations but generation_time != 1.0".to_string(),
));
}
Expand Down
2 changes: 1 addition & 1 deletion tests/test_bad_yaml_inputs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -824,7 +824,7 @@ demes:
";
match demes::loads(yaml) {
Ok(_) => panic!("expected Err!"),
Err(e) => assert!(matches!(e, demes::DemesError::TopLevelError(_))),
Err(e) => assert!(matches!(e, demes::DemesError::GraphError(_))),
}
}

Expand Down

0 comments on commit 8c0539e

Please sign in to comment.