mirror of
https://github.com/sharkdp/bat.git
synced 2024-11-02 21:01:01 +01:00
26 lines
652 B
Rust
26 lines
652 B
Rust
use error_chain::error_chain;
|
|
|
|
error_chain! {
|
|
foreign_links {
|
|
Clap(::clap::Error);
|
|
Io(::std::io::Error);
|
|
SyntectError(::syntect::LoadingError);
|
|
ParseIntError(::std::num::ParseIntError);
|
|
GlobParsingError(::globset::Error);
|
|
}
|
|
}
|
|
|
|
pub fn default_error_handler(error: &Error) {
|
|
match error {
|
|
Error(ErrorKind::Io(ref io_error), _)
|
|
if io_error.kind() == ::std::io::ErrorKind::BrokenPipe =>
|
|
{
|
|
::std::process::exit(0);
|
|
}
|
|
_ => {
|
|
use ansi_term::Colour::Red;
|
|
eprintln!("{}: {}", Red.paint("[bat error]"), error);
|
|
}
|
|
};
|
|
}
|