8 Io(#[from] ::std::io::Error),
10 SyntectError(#[from] ::syntect::Error),
12 SyntectLoadingError(#[from] ::syntect::LoadingError),
14 ParseIntError(#[from] ::std::num::ParseIntError),
16 GlobParsingError(#[from] ::globset::Error),
18 SerdeYamlError(#[from] ::serde_yaml::Error),
19 #[error("unable to detect syntax for {0}")]
20 UndetectedSyntax(String),
21 #[error("unknown syntax: '{0}'")]
22 UnknownSyntax(String),
23 #[error("Unknown style '{0}'")]
25 #[error("Use of bat as a pager is disallowed in order to avoid infinite recursion problems")]
31impl From<&'static str> for Error {
32 fn from(s: &'static str) -> Self {
33 Error::Msg(s.to_owned())
37impl From<String> for Error {
38 fn from(s: String) -> Self {
43pub type Result<T> = std::result::Result<T, Error>;
45pub fn default_error_handler(error: &Error, output: &mut dyn Write) {
46 use ansi_term::Colour::Red;
49 Error::Io(ref io_error) if io_error.kind() == ::std::io::ErrorKind::BrokenPipe => {
50 ::std::process::exit(0);
52 Error::SerdeYamlError(_) => {
55 "{}: Error while parsing metadata.yaml file: {}",
56 Red.paint("[bat error]"),
62 writeln!(output, "{}: {}", Red.paint("[bat error]"), error).ok();
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list