No longer panic on startup/shutdown errors

This commit is contained in:
Antoine Gersant 2016-12-03 12:33:30 -08:00
parent 2f49aa0e40
commit c02b971984

View file

@ -89,7 +89,7 @@ fn run() -> Result<()> {
// Init index // Init index
println!("Starting up index"); println!("Starting up index");
let index = Arc::new(index::Index::new(vfs.clone(), &config.index).unwrap()); let index = Arc::new(index::Index::new(vfs.clone(), &config.index)?);
let index_ref = index.clone(); let index_ref = index.clone();
std::thread::spawn(move || index_ref.run()); std::thread::spawn(move || index_ref.run());
@ -100,7 +100,7 @@ fn run() -> Result<()> {
let api_handler; let api_handler;
{ {
let mut collection = collection::Collection::new(vfs, index); let mut collection = collection::Collection::new(vfs, index);
collection.load_config(&config).unwrap(); collection.load_config(&config)?;
let collection = Arc::new(collection); let collection = Arc::new(collection);
api_handler = api::get_api_handler(collection); api_handler = api::get_api_handler(collection);
} }
@ -131,7 +131,7 @@ fn run() -> Result<()> {
ui::run(); ui::run();
println!("Shutting down server"); println!("Shutting down server");
server.close().unwrap(); server.close()?;
Ok(()) Ok(())
} }