#[non_exhaustive]pub enum L10nError {
Decompression(String),
InvalidUtf8(FromUtf8Error),
InvalidLanguage {
lang: String,
reason: String,
},
Builtins(String),
ResourceParse(Vec<String>),
AddResource(Vec<String>),
MessageNotFound {
id: String,
},
MessageHasNoValue {
id: String,
},
AttributeNotFound {
id: String,
attribute: String,
},
Format {
id: String,
attribute: Option<String>,
errors: Vec<String>,
},
}Expand description
An error from loading a localization bundle or formatting one of its messages at runtime.
Returned by L10nBundle,
L10nLanguageVec and the generated
L10nLanguage::new. The generated message accessors unwrap this: a failure
there means the generated code and the embedded .ftl have drifted apart,
which is a build-time bug rather than something to handle at runtime.
The variants carry owned strings rather than fluent-bundle’s own error
types on purpose, so this enum does not change shape when that (pre-1.0)
dependency is updated. It is #[non_exhaustive] so new variants can be added
in a minor release.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Decompression(String)
The user-supplied decompressor (for a compressed single-file build) returned an error. Carries that error’s message.
InvalidUtf8(FromUtf8Error)
The .ftl bytes were not valid UTF-8.
InvalidLanguage
The language identifier (e.g. "en-US") could not be parsed.
Fields
Builtins(String)
The Fluent builtins (NUMBER, …) could not be registered on the bundle.
ResourceParse(Vec<String>)
The .ftl resource failed to parse. One entry per parser error.
AddResource(Vec<String>)
The resource could not be added to the bundle (e.g. a message id that collides with one already present).
MessageNotFound
No message with this id exists in the bundle.
MessageHasNoValue
The message exists but has no value of its own (it has only attributes).
AttributeNotFound
The message exists but has no attribute with this name.
Format
Formatting the message or attribute failed — typically a missing or wrongly-typed argument. One entry per formatting error.
Trait Implementations§
Source§impl Error for L10nError
impl Error for L10nError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()