Skip to content

Commit ef0cefe

Browse files
committed
Add error message if parsing file panics
Damn, this thing is fast if built with `cargo build --release`... Maybe because the paths and function calls are in the source file and executed at compile time? and that's why? Maybe later, there will be 2 options -> running with paths as command-line arguments -> compiling it itself with paths as part of the source file! I will have to test the performance of both options This currently built with `--release`` executes in under 2s xDDDD Compared to the Python version... that's insane Jesus Christ
1 parent 5bc0e1e commit ef0cefe

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,5 @@ fn main() {
2828
name: String::from("Powerwolf"),
2929
};
3030
display::print_top_from_artist(&entries, Aspect::Songs, &powerwolf, 10);
31-
display::print_top_from_artist(&entries, Aspect::Albums, &powerwolf, 10)
31+
display::print_top_from_artist(&entries, Aspect::Albums, &powerwolf, 10);
3232
}

src/parse.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ struct Entry {
5151
}
5252

5353
fn parse_single(path: String) -> Vec<SongEntry> {
54-
let u = read_entries_from_file(path).unwrap();
54+
let u = read_entries_from_file(&path).expect(format!("File {} is invalid!", &path).as_str());
5555
let mut songs: Vec<SongEntry> = Vec::new();
5656
let mut podcasts: Vec<Entry> = Vec::new();
5757
for entry in u {

0 commit comments

Comments
 (0)