on fccbe4f help sign in
bat/src/errors.rs
25 lines 684 B history raw
1use error_chain::error_chain;
3error_chain! {
4 foreign_links {
5 Clap(::clap::Error) #[cfg(feature = "application")];
6 Io(::std::io::Error);
7 SyntectError(::syntect::LoadingError);
8 ParseIntError(::std::num::ParseIntError);
9 GlobParsingError(::globset::Error);
10 }
13pub fn default_error_handler(error: &Error) {
14 match error {
15 Error(ErrorKind::Io(ref io_error), _)
16 if io_error.kind() == ::std::io::ErrorKind::BrokenPipe =>
17 {
18 ::std::process::exit(0);
19 }
20 _ => {
21 use ansi_term::Colour::Red;
22 eprintln!("{}: {}", Red.paint("[bat error]"), error);
23 }
24 };