Browse Source

Prevent panics when bad state is found - e.g. no meta.json or no indexing dir.

develop
Ewan Higgs 6 years ago
parent
commit
46f4af07a8
2 changed files with 9 additions and 2 deletions
  1. +1
    -0
      src/errors.rs
  2. +8
    -2
      src/main.rs

+ 1
- 0
src/errors.rs View File

@@ -0,0 +1 @@
error_chain!{}

+ 8
- 2
src/main.rs View File

@@ -22,7 +22,6 @@ extern crate byteorder;
#[macro_use]
extern crate serde_derive;


use clap::{AppSettings, Arg, App, SubCommand};
mod commands;
use self::commands::*;
@@ -137,5 +136,12 @@ fn main() {
"bench" => run_bench_cli,
_ => panic!("Subcommand {} is unknown", subcommand)
};
run_cli(options).unwrap();

if let Err(ref e) = run_cli(options) {
use std::io::Write;
let stderr = &mut ::std::io::stderr();
let errmsg = "Error writing ot stderr";
writeln!(stderr, "{}", e).expect(errmsg);
::std::process::exit(1);
}
}

Loading…
Cancel
Save