@@ -112,7 +112,7 @@ impl<'a> InteractivePrinter<'a> {
112112 assets: &'a HighlightingAssets,
113113 input: &mut OpenedInput,
114114 #[cfg(feature = "git")] line_changes: &'a Option<LineChanges>,
115− ) -> Self {
115+ ) -> Result<Self> {
116116 let theme = assets.get_theme(&config.theme);
117117
118118 let background_color_highlight = theme.settings.line_highlight;
@@ -164,14 +164,18 @@ impl<'a> InteractivePrinter<'a> {
164164 None
165165 } else {
166166 // Determine the type of syntax for highlighting
167− let syntax = assets
168− .get_syntax(config.language, input, &config.syntax_mapping)
169− .unwrap_or_else(|_| assets.syntax_set.find_syntax_plain_text());
167+ let syntax = match assets.get_syntax(config.language, input, &config.syntax_mapping) {
168+ Ok(syntax) => syntax,
169+ Err(Error(ErrorKind::UndetectedSyntax(_), _)) => {
170+ assets.syntax_set.find_syntax_plain_text()
171+ }
172+ Err(e) => return Err(e),
173+ };
170174
171175 Some(HighlightLines::new(syntax, theme))
172176 };
173177
174− InteractivePrinter {
178+ Ok(InteractivePrinter {
175179 panel_width,
176180 colors,
177181 config,
@@ -183,7 +187,7 @@ impl<'a> InteractivePrinter<'a> {
183187 highlighter,
184188 syntax_set: &assets.syntax_set,
185189 background_color_highlight,
186− }
190+ })
187191 }
188192
189193 fn print_horizontal_line(&mut self, handle: &mut dyn Write, grid_char: char) -> Result<()> {