rm: after_fact()'s return val(Error)

This commit is contained in:
itiB
2020-11-29 02:04:28 +09:00
parent d4ceb8ea8f
commit 90bf79f85b
2 changed files with 7 additions and 7 deletions

View File

@@ -3,6 +3,7 @@ use crate::detections::print;
use chrono::{DateTime, TimeZone, Utc}; use chrono::{DateTime, TimeZone, Utc};
use serde::Serialize; use serde::Serialize;
use std::error::Error; use std::error::Error;
use std::process;
#[derive(Debug, Serialize)] #[derive(Debug, Serialize)]
#[serde(rename_all = "PascalCase")] #[serde(rename_all = "PascalCase")]
@@ -11,12 +12,13 @@ pub struct CsvFormat<'a> {
message: &'a str, message: &'a str,
} }
pub fn after_fact() -> Result<(), Box<dyn Error>> { pub fn after_fact() {
if let Some(csv_path) = configs::singleton().args.value_of("csv-timeline") { if let Some(csv_path) = configs::singleton().args.value_of("csv-timeline") {
emit_csv(csv_path)?; if let Err(err) = emit_csv(csv_path) {
println!("{}", err);
process::exit(1);
}
} }
Ok(())
} }
fn emit_csv(path: &str) -> Result<(), Box<dyn Error>> { fn emit_csv(path: &str) -> Result<(), Box<dyn Error>> {

View File

@@ -20,9 +20,7 @@ fn main() -> Result<(), DeError> {
parse_file(&filepath); parse_file(&filepath);
} }
if let Err(err) = after_fact() { after_fact();
println!("{}", err);
}
Ok(()) Ok(())
} }