Skip to content

Commit dde3eed

Browse files
authored
[rust] Panic if JSON output is used but no entries are collected (#13101)
1 parent 2008e10 commit dde3eed

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

rust/src/logger.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ use Color::{Blue, Cyan, Green, Red, Yellow};
3333
pub const DRIVER_PATH: &str = "Driver path: ";
3434
pub const BROWSER_PATH: &str = "Browser path: ";
3535

36-
#[derive(Default)]
36+
#[derive(Default, PartialEq)]
3737
enum OutputType {
3838
#[default]
3939
Logger,
@@ -219,6 +219,8 @@ impl Logger {
219219
let json = json_output.deref();
220220
if !json.logs.is_empty() {
221221
print!("{}", serde_json::to_string_pretty(json).unwrap());
222+
} else if self.output == OutputType::Json {
223+
panic!("JSON output has been specified, but no entries have been collected")
222224
}
223225
}
224226
}

0 commit comments

Comments
 (0)