Skip to content

Commit 92d15bf

Browse files
committedNov 4, 2018
when not git repo --> exit(1) instead of panic!
1 parent 1bd15cb commit 92d15bf

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed
 

Diff for: ‎src/main.rs

+7-3
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ use std::str::FromStr;
1313
use license::License;
1414
use std::ffi::OsStr;
1515
use std::fmt::Write;
16+
use std::process::exit;
1617

1718
struct Info {
1819
project_name: String,
@@ -167,20 +168,23 @@ fn main() {
167168
let language = match get_dominant_language(&tokei_langs) {
168169
Some(language) => language,
169170
None => {
170-
eprintln!("Could not find any source code in this directory.");
171+
eprintln!("Error: Could not find any source code in this directory.");
171172
return;
172173
}
173174
};
174175

175176
if !is_git_installed() {
176-
eprintln!("Could not execute git for project information.");
177+
eprintln!("Error: Could not execute git for project information.");
177178
return;
178179
}
179180

180181
let authors = get_authors(3);
181182
let config: Configuration = match get_configuration() {
182183
Ok(config) => config,
183-
Err(_) => panic!("Could not retrieve git configuration data"),
184+
Err(_) => {
185+
eprintln!("Error: Could not retrieve git configuration data");
186+
exit(1);
187+
}
184188
};
185189

186190

0 commit comments

Comments
 (0)