message: more error handling for statistics
diff: use super::{error::StatError, field::StatField};
  +use crate::utils::fmt_err;
  use crate::{
  config::CONFIGURATION,
  reporter::{get_cached_file_handle, safe_file_write},
  @@ -339,13 +340,14 @@ impl Stats {
  /// Merge a given `Stats` object from a json entry written to disk when handling a Ctrl+c
  ///
  /// This is only ever called when resuming a scan from disk
  - pub fn merge_from(&self, filename: &str) {
  - if let Ok(file) = File::open(filename) {
  + pub fn merge_from(&self, filename: &str) -> Result<()> {
  + let file =
  + File::open(filename).with_context(fmt_err(&format!("Could not open {}", filename)))?;
  let reader = BufReader::new(file);
  - let state: serde_json::Value = serde_json::from_reader(reader).unwrap();
  + let state: serde_json::Value = serde_json::from_reader(reader)?;
  if let Some(state_stats) = state.get("statistics") {
  - if let Ok(d_stats) = serde_json::from_value::<Stats>(state_stats.clone()) {
  + let d_stats = serde_json::from_value::<Stats>(state_stats.clone())?;
  atomic_increment!(self.successes, atomic_load!(d_stats.successes));
  atomic_increment!(self.timeouts, atomic_load!(d_stats.timeouts));
  atomic_increment!(self.requests, atomic_load!(d_stats.requests));
  @@ -396,8 +398,7 @@ impl Stats {
  }
  }
  }
  - }
  - }
  + Ok(())
  }
  }
  