Skip to content

Commit

Permalink
use eyre::ensure
Browse files Browse the repository at this point in the history
  • Loading branch information
mattsse committed Jul 4, 2024
1 parent 77ff0d2 commit 7b68eac
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions crates/cli/commands/src/db/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,14 @@ impl Command {
let static_files_path = data_dir.static_files();

// ensure the provided datadir exist
if !db_path.is_dir() {
return Err(eyre::eyre!("Database path does not exist: {:?}", db_path));
}
if !static_files_path.is_dir() {
return Err(eyre::eyre!("Static files path does not exist: {:?}", static_files_path));
}
eyre::ensure!(
data_dir.data_dir().is_dir(),
"Datadir does not exist: {:?}",
data_dir.data_dir()
);

// ensure the provided database exist
eyre::ensure!(db_path.is_dir(), "Database does not exist: {:?}", db_path);

match self.command {
// TODO: We'll need to add this on the DB trait.
Expand Down

0 comments on commit 7b68eac

Please sign in to comment.