Overhaul CLI error handling to allow multiple levels of context

This commit is contained in:
Max Brunsfeld 2019-05-30 16:52:30 -07:00
parent b7bc2d30ae
commit d274e81d0d
17 changed files with 214 additions and 129 deletions

View file

@ -362,20 +362,22 @@ fn language_for_injection_string<'a>(
string: &str,
) -> Option<(Language, &'a PropertySheet<Properties>)> {
match loader.language_configuration_for_injection_string(string) {
Err(message) => {
Err(e) => {
eprintln!(
"Failed to load language for injection string '{}': {}",
string, message.0
string,
e.message()
);
None
}
Ok(None) => None,
Ok(Some((language, configuration))) => {
match configuration.highlight_property_sheet(language) {
Err(message) => {
Err(e) => {
eprintln!(
"Failed to load property sheet for injection string '{}': {}",
string, message.0
string,
e.message()
);
None
}