Enum google_fonts::error::FontError
source · pub enum FontError {
Network(Error),
Deserialize(Error),
CacheDir(StringError),
CacheFile(Error),
}Expand description
An error that can occur while using the google-fonts crate.
This enum represents various errors that can be encountered while downloading, deserializing, caching, or otherwise handling fonts from Google Fonts. Each variant corresponds to a specific type of error that can occur during the process.
§Variants
Network: Indicates an error that occurred while making a network request.Deserialize: Indicates an error that occurred while deserializing JSON data.CacheDir: Indicates an error that occurred while interacting with the cache directory.CacheFile: Indicates an error that occurred while interacting with a cache file.
Variants§
Network(Error)
An error that occurred while making a network request.
This variant wraps a reqwest::Error, which provides more details
about the specific network-related error that occurred.
§Example
use google_fonts::FontError;
if let FontError::Network(e) = error {
println!("Network error: {}", e);
}Deserialize(Error)
An error that occurred while deserializing JSON data.
This variant wraps a serde_json::Error, which provides more details
about the specific deserialization error that occurred.
§Example
use google_fonts::FontError;
if let FontError::Deserialize(e) = error {
println!("Deserialization error: {}", e);
}CacheDir(StringError)
An error that occurred while interacting with the cache directory.
This variant wraps a StringError, which provides more details
about the specific error related to the cache directory.
§Example
use google_fonts::FontError;
if let FontError::CacheDir(e) = error {
println!("Cache directory error: {}", e);
}CacheFile(Error)
An error that occurred while interacting with a cache file.
This variant wraps a std::io::Error, which provides more details
about the specific I/O error that occurred.
§Example
use google_fonts::FontError;
if let FontError::CacheFile(e) = error {
println!("Cache file error: {}", e);
}