From 9660612724514aa6e8f78b719c36a1c943033b1f Mon Sep 17 00:00:00 2001 From: Jan-Erik Rediger Date: Tue, 11 Apr 2023 13:14:26 +0200 Subject: [PATCH] Make the error message more useful when no git root can be found Fixes #4 --- src/lib.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index 5fdce9e..4f222fb 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -15,7 +15,8 @@ impl Preprocessor for LastChanged { fn run(&self, ctx: &PreprocessorContext, mut book: Book) -> Result { let book_root = &ctx.root; let src_root = book_root.join(&ctx.config.book.src); - let git_root = find_git(book_root).unwrap(); + let git_root = find_git(book_root) + .expect("Couldn't find the root of this project. Not a git repository?"); log::debug!("Book root: {}", book_root.display()); log::debug!("Src root: {}", src_root.display()); log::debug!("Git root: {}", git_root.display());