Skip to content

Commit c695234

Browse files
Merge pull request #247 from jonas-schievink/error-msgs
Better error messages in options.rs
2 parents 053eb8b + 66b6eb9 commit c695234

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/docbuilder/options.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
use std::{env, fmt};
44
use std::path::PathBuf;
55
use error::Result;
6-
use failure::err_msg;
76

87
#[derive(Clone)]
98
pub struct DocBuilderOptions {
@@ -94,16 +93,16 @@ impl DocBuilderOptions {
9493

9594
pub fn check_paths(&self) -> Result<()> {
9695
if !self.destination.exists() {
97-
return Err(err_msg("Destination path not exists"));
96+
bail!("destination path '{}' does not exist", self.destination.display());
9897
}
9998
if !self.chroot_path.exists() {
100-
return Err(err_msg("Chroot path not exists"));
99+
bail!("chroot path '{}' does not exist", self.chroot_path.display());
101100
}
102101
if !self.crates_io_index_path.exists() {
103-
return Err(err_msg("crates.io-index path not exists"));
102+
bail!("crates.io-index path '{}' does not exist", self.crates_io_index_path.display());
104103
}
105-
if !self.crates_io_index_path.exists() {
106-
return Err(err_msg("Logs path not exists"));
104+
if !self.sources_path.exists() {
105+
bail!("sources path '{}' does not exist", self.sources_path.display());
107106
}
108107
Ok(())
109108
}

0 commit comments

Comments
 (0)