on master help sign in
Print error if Default.tmTheme is not available

closes #15

commit64de2a44d56615c24115566ac75634c257c3fa6b authorsharkdp <davidpeter@web.de> dateWed 25 Apr 2018, 23:34 (9 years ago) parent716b261
1 file changed+4−1
src/main.rs+4−1
src/main.rs+4−1
@@ -196,7 +196,10 @@ fn run(matches: &ArgMatches) -> Result<()> {
196196 let theme_dir = home_dir.join(".config").join("bat").join("themes");
197197 let theme_set = ThemeSet::load_from_folder(theme_dir)
198198 .map_err(|_| io::Error::new(ErrorKind::Other, "Could not load themes"))?;
199− let theme = &theme_set.themes["Default"];
199+ let theme = &theme_set.themes.get("Default").ok_or(io::Error::new(
200+ ErrorKind::Other,
201+ "Could not load default theme (~/.config/bat/themes/Default.tmTheme)",
202+ ))?;
200203
201204 // TODO: let mut syntax_set = SyntaxSet::load_defaults_nonewlines();
202205 let mut syntax_set = SyntaxSet::new();