Pretty-print runtime errors

This commit is contained in:
Félix Saparelli 2022-01-31 03:01:00 +13:00
parent 427e4a0d08
commit c6f230a168
1 changed files with 3 additions and 3 deletions

View File

@ -1,7 +1,7 @@
use std::convert::Infallible; use std::convert::Infallible;
use clap::ArgMatches; use clap::ArgMatches;
use miette::Result; use miette::{Report, Result};
use tracing::error; use tracing::error;
use watchexec::{config::InitConfig, error::RuntimeError, handler::SyncFnHandler}; use watchexec::{config::InitConfig, error::RuntimeError, handler::SyncFnHandler};
@ -22,10 +22,10 @@ pub fn init(_args: &ArgMatches<'static>) -> Result<InitConfig> {
if cfg!(debug_assertions) { if cfg!(debug_assertions) {
eprintln!("[[{:?}]]", data); eprintln!("[[{:?}]]", data);
} else {
eprintln!("[[{}]]", data);
} }
eprintln!("[[Error (not fatal)]]\n{}", Report::new(data));
Ok(()) Ok(())
}, },
)); ));