mirror of
https://github.com/sharkdp/bat.git
synced 2026-10-29 09:06:02 +00:00
1 parent
3bcc4d0d55
commit
48a7ce3bf2
4 files changed
+37
-10
No files matched your search
+7
-4
@@ -1,4 +1,5 @@
|
||||
use error_chain::error_chain;
|
||||
use std::io::Write;
|
||||
|
||||
error_chain! {
|
||||
foreign_links {
|
||||
@@ -11,7 +12,7 @@ error_chain! {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn default_error_handler(error: &Error) {
|
||||
pub fn default_error_handler(error: &Error, output: &mut dyn Write) {
|
||||
use ansi_term::Colour::Red;
|
||||
|
||||
match error {
|
||||
@@ -21,14 +22,16 @@ pub fn default_error_handler(error: &Error) {
|
||||
::std::process::exit(0);
|
||||
}
|
||||
Error(ErrorKind::SerdeYamlError(_), _) => {
|
||||
eprintln!(
|
||||
writeln!(
|
||||
output,
|
||||
"{}: Error while parsing metadata.yaml file: {}",
|
||||
Red.paint("[bat error]"),
|
||||
error
|
||||
);
|
||||
)
|
||||
.ok();
|
||||
}
|
||||
_ => {
|
||||
eprintln!("{}: {}", Red.paint("[bat error]"), error);
|
||||
writeln!(output, "{}: {}", Red.paint("[bat error]"), error).ok();
|
||||
}
|
||||
};
|
||||
}
|
||||
Reference in new issue
Block a user