Skip to content

Commit 0a08bf6

Browse files
Better error messages in options.rs
1 parent b0cf9b8 commit 0a08bf6

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/docbuilder/options.rs

Lines changed: 3 additions & 7 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,13 @@ 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!("destionation 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"));
104-
}
105-
if !self.crates_io_index_path.exists() {
106-
return Err(err_msg("Logs path not exists"));
102+
bail!("crates.io-index path '{}' does not exist", self.crates_io_index_path.display());
107103
}
108104
Ok(())
109105
}

0 commit comments

Comments
 (0)