mirror of
https://github.com/sharkdp/bat.git
synced 2024-12-22 14:30:42 +01:00
Better error messages
This commit is contained in:
parent
f81e38618c
commit
ced6801740
@ -22,7 +22,7 @@ lazy_static = "1.0"
|
|||||||
[dependencies.syntect]
|
[dependencies.syntect]
|
||||||
version = "2"
|
version = "2"
|
||||||
default-features = false
|
default-features = false
|
||||||
features = ["parsing", "yaml-load", "dump-load", "assets", "dump-create"]
|
features = ["parsing", "yaml-load", "dump-load", "dump-create"]
|
||||||
|
|
||||||
[dependencies.clap]
|
[dependencies.clap]
|
||||||
version = "2"
|
version = "2"
|
||||||
|
@ -47,4 +47,6 @@ cd ~/.config/bat/syntax
|
|||||||
git clone https://github.com/sublimehq/Packages/
|
git clone https://github.com/sublimehq/Packages/
|
||||||
rm -rf Packages/Markdown
|
rm -rf Packages/Markdown
|
||||||
git clone https://github.com/jonschlinkert/sublime-markdown-extended
|
git clone https://github.com/jonschlinkert/sublime-markdown-extended
|
||||||
|
|
||||||
|
bat init-cache
|
||||||
```
|
```
|
||||||
|
18
src/main.rs
18
src/main.rs
@ -283,20 +283,30 @@ impl HighlightingAssets {
|
|||||||
let theme_set_path = cache_dir.join("theme_set");
|
let theme_set_path = cache_dir.join("theme_set");
|
||||||
let syntax_set_path = cache_dir.join("syntax_set");
|
let syntax_set_path = cache_dir.join("syntax_set");
|
||||||
|
|
||||||
let syntax_set_file = File::open(syntax_set_path)?;
|
let syntax_set_file = File::open(&syntax_set_path).chain_err(|| {
|
||||||
|
format!(
|
||||||
|
"Could not load cached syntax set '{}'",
|
||||||
|
syntax_set_path.to_string_lossy()
|
||||||
|
)
|
||||||
|
})?;
|
||||||
let mut syntax_set: SyntaxSet = from_reader(syntax_set_file).map_err(|_| {
|
let mut syntax_set: SyntaxSet = from_reader(syntax_set_file).map_err(|_| {
|
||||||
io::Error::new(
|
io::Error::new(
|
||||||
io::ErrorKind::Other,
|
io::ErrorKind::Other,
|
||||||
format!("Could not load cached syntax set"),
|
format!("Could not parse cached syntax set"),
|
||||||
)
|
)
|
||||||
})?;
|
})?;
|
||||||
syntax_set.link_syntaxes();
|
syntax_set.link_syntaxes();
|
||||||
|
|
||||||
let theme_set_file = File::open(theme_set_path)?;
|
let theme_set_file = File::open(&theme_set_path).chain_err(|| {
|
||||||
|
format!(
|
||||||
|
"Could not load cached theme set '{}'",
|
||||||
|
theme_set_path.to_string_lossy()
|
||||||
|
)
|
||||||
|
})?;
|
||||||
let theme_set: ThemeSet = from_reader(theme_set_file).map_err(|_| {
|
let theme_set: ThemeSet = from_reader(theme_set_file).map_err(|_| {
|
||||||
io::Error::new(
|
io::Error::new(
|
||||||
io::ErrorKind::Other,
|
io::ErrorKind::Other,
|
||||||
format!("Could not load cached theme set"),
|
format!("Could not parse cached theme set"),
|
||||||
)
|
)
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user