Move miette set earlier
Browse files at this commit8bcd18ace2767a0fa034d76d58ffdb5657ce9bf5Parent: 4fefab71 changed file +3 -1
- src/main.rs +3 -1
src/main.rsmodified+3 -1
| @@ -92,6 +92,9 @@ fn main() { | |||
| 92 | 92 | ||
| 93 | let _client = tracy_client::Client::start(); | 93 | let _client = tracy_client::Client::start(); |
| 94 | 94 | ||
| 95 | + // Set a better error printer for config loading. | ||
| 96 | + miette::set_hook(Box::new(|_| Box::new(NarratableReportHandler::new()))).unwrap(); | ||
| 97 | + | ||
| 95 | info!( | 98 | info!( |
| 96 | "starting version {} ({})", | 99 | "starting version {} ({})", |
| 97 | env!("CARGO_PKG_VERSION"), | 100 | env!("CARGO_PKG_VERSION"), |
| @@ -99,7 +102,6 @@ fn main() { | |||
| 99 | ); | 102 | ); |
| 100 | 103 | ||
| 101 | // Load the config. | 104 | // Load the config. |
| 102 | - miette::set_hook(Box::new(|_| Box::new(NarratableReportHandler::new()))).unwrap(); | ||
| 103 | let (mut config, path) = match Config::load(cli.config).context("error loading config") { | 105 | let (mut config, path) = match Config::load(cli.config).context("error loading config") { |
| 104 | Ok((config, path)) => (config, Some(path)), | 106 | Ok((config, path)) => (config, Some(path)), |
| 105 | Err(err) => { | 107 | Err(err) => { |