diff options
Diffstat (limited to 'src/useropts.rs')
-rw-r--r-- | src/useropts.rs | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/useropts.rs b/src/useropts.rs index b342839..27e14df 100644 --- a/src/useropts.rs +++ b/src/useropts.rs @@ -20,14 +20,13 @@ use super::render::{Alignment, RenderOptions}; pub enum ConfigError { Io(io::Error), Serialization(toml::de::Error), - Font(rusttype::Error), + Font, } error_froms! { ConfigError, err: io::Error => ConfigError::Io(err), err: toml::de::Error => ConfigError::Serialization(err), - err: rusttype::Error => ConfigError::Font(err), } impl fmt::Display for ConfigError { @@ -36,7 +35,7 @@ impl fmt::Display for ConfigError { match *self { ConfigError::Io(_) => write!(f, "input/output error"), ConfigError::Serialization(_) => write!(f, "serialization error"), - ConfigError::Font(_) => write!(f, "could not load the font"), + ConfigError::Font => write!(f, "could not load the font"), } } } @@ -46,7 +45,7 @@ impl Error for ConfigError { match *self { ConfigError::Io(ref err) => Some(err), ConfigError::Serialization(ref err) => Some(err), - ConfigError::Font(ref err) => Some(err), + ConfigError::Font => None, } } } @@ -109,7 +108,7 @@ impl UserOptions { if let Some(path) = self.font_path { let data = fs::read(path)?; - let font = Font::from_bytes(data)?; + let font = Font::try_from_vec(data).ok_or(ConfigError::Font)?; result.font = font; } |