Skip to content

Commit 7f7df66

Browse files
committed
Avoid panic for invalid selector
1 parent 0303986 commit 7f7df66

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

scraper/src/main.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,10 @@ fn main() {
125125
});
126126
let files = &matches.free[1..];
127127

128-
let selector = Selector::parse(selector).unwrap();
128+
let selector = Selector::parse(selector).unwrap_or_else(|e| {
129+
eprintln!("failed to parse selector: {}", e);
130+
process::exit(EX_USAGE);
131+
});
129132

130133
let matched = if files.is_empty() {
131134
query(&input, &output, &selector, &mut io::stdin())

0 commit comments

Comments
 (0)