Skip to content

Commit

Permalink
improve addchemistry error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
an-altosian committed Dec 17, 2024
1 parent eb9994a commit 01c9ea2
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/simpleaf_commands/chemistry.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::utils::af_utils::*;

use anyhow::{bail, Context, Result};
use anyhow::{anyhow, bail, Context, Result};
use std::io::{Seek, Write};
use std::path::PathBuf;
use tracing::info;
Expand All @@ -20,10 +20,14 @@ pub fn add_chemistry(af_home_path: PathBuf, add_chem_cmd: Commands) -> Result<()
} => {
// check geometry string, if no good then
// propagate error.
extract_geometry(&geometry)?;
match extract_geometry(&geometry) {
Ok(_) => {}
Err(e) => {
Err(anyhow!("Could not parse the input string to --geometry. Please make sure it is valid and wrapped in quotes. The error message was: {}", e))?;
}
};
Version::parse(version.as_ref()).with_context(|| format!("could not parse version {}. Please follow https://semver.org/. A valid example is 0.1.0", version))?;


// init the custom chemistry struct
let custom_chem = CustomChemistry {
name: name.clone(),
Expand Down

0 comments on commit 01c9ea2

Please sign in to comment.