Improve serialization error messages

This commit is contained in:
Austen Adler 2021-05-12 22:22:18 -04:00
parent 8ad770d046
commit b382ffbbbe

View File

@ -39,8 +39,10 @@ impl fmt::Display for CalculatorError {
CalculatorError::ParseError => write!(f, "Parse error"), CalculatorError::ParseError => write!(f, "Parse error"),
CalculatorError::PrecisionTooHigh => write!(f, "Precision too high"), CalculatorError::PrecisionTooHigh => write!(f, "Precision too high"),
CalculatorError::SaveError(None) => write!(f, "Could not save"), CalculatorError::SaveError(None) => write!(f, "Could not save"),
CalculatorError::SaveError(Some(ConfyError::SerializeTomlError(e))) => write!(f, "Save serialization error: {}", e),
CalculatorError::SaveError(Some(e)) => write!(f, "Could not save: {}", e), CalculatorError::SaveError(Some(e)) => write!(f, "Could not save: {}", e),
CalculatorError::LoadError(None) => write!(f, "Could not load"), CalculatorError::LoadError(None) => write!(f, "Could not load"),
CalculatorError::LoadError(Some(ConfyError::SerializeTomlError(e))) => write!(f, "Load serialization error: {}", e),
CalculatorError::LoadError(Some(e)) => write!(f, "Could not load: {}", e), CalculatorError::LoadError(Some(e)) => write!(f, "Could not load: {}", e),
} }
} }