From 78c145b2f4024c144b67b7452900b90116acdc50 Mon Sep 17 00:00:00 2001 From: Marco Castelluccio Date: Sat, 11 Jun 2022 21:21:22 +0200 Subject: [PATCH] Return a non-0 exit code in case of errors that should not be ignored See also #838 --- src/lib.rs | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 89a5762f9..daf541938 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -189,8 +189,7 @@ pub fn consumer( ItemType::Path((stem, gcno_path)) => { // GCC if let Err(e) = run_gcov(&gcno_path, branch_enabled, working_dir) { - error!("Error when running gcov: {}", e); - continue; + panic!("Error when running gcov: {}", e); }; let gcov_ext = get_gcov_output_ext(); let gcov_path = @@ -266,19 +265,16 @@ pub fn consumer( } } ItemType::Content(_) => { - error!("Invalid content type"); - continue; + panic!("Invalid content type"); } ItemType::Paths(_) => { - error!("Invalid content type"); - continue; + panic!("Invalid content type"); } } } ItemFormat::Profraw => { if binary_path.is_none() { - error!("The path to the compiled binary must be given as an argument when source-based coverage is used"); - continue; + panic!("The path to the compiled binary must be given as an argument when source-based coverage is used"); } if let ItemType::Paths(profraw_paths) = work_item.item { @@ -300,13 +296,11 @@ pub fn consumer( new_results } Err(e) => { - error!("Error while executing llvm tools: {}", e); - continue; + panic!("Error while executing llvm tools: {}", e); } } } else { - error!("Invalid content type"); - continue; + panic!("Invalid content type"); } } ItemFormat::Info | ItemFormat::JacocoXml => { @@ -318,8 +312,7 @@ pub fn consumer( try_parse!(parse_jacoco_xml_report(buffer), work_item.name) } } else { - error!("Invalid content type"); - continue; + panic!("Invalid content type"); } } };