#[non_exhaustive]pub enum Error {
Show 13 variants
Io {
path: String,
source: Error,
},
Json {
path: String,
offset: usize,
kind: &'static str,
},
NotObject {
path: String,
},
UnknownLocale(String),
DisabledLocale(String),
UnknownPage(String),
Config {
path: String,
reason: &'static str,
},
UnknownFile(String),
AlreadyInstalled,
NotInstalled,
UnsupportedFormat {
locale: String,
name: String,
option: String,
},
UnknownTimeZone(String),
Fetch {
path: String,
message: String,
},
}Expand description
What went wrong while building the catalog or switching it.
A broken or non-object locale file is an error with its path. The JS loader logs it and skips the file; Rust refuses to start with half a catalog instead.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Io
A file or directory could not be read.
Fields
Json
A locale file, messages text or i18n.json is not valid JSON.
Fields
NotObject
Valid JSON, but not an object (an array, null, a string…).
UnknownLocale(String)
A locale that no file, i18n.json entry or builder call names.
DisabledLocale(String)
A locale i18n.json marks "disabled": true.
UnknownPage(String)
A page name that is not allowed or not known (__proto__, an alias to nothing).
Config
i18n.json has the wrong shape.
Fields
UnknownFile(String)
A path add_file was given that the remote manifest does not list (8b.2: names
only from the catalog).
AlreadyInstalled
install was called while an instance is installed already.
NotInstalled
A free function (set_locale) needs an instance: none is installed, no scope sets one.
UnsupportedFormat
A named format (numberFormats / datetimeFormats of i18n.json,
Builder::formats / Builder::datetime_formats) uses an Intl option outside the
supported subset (signDisplay: "always", style: "unit", timeStyle: "full",
timeZoneName…) or a value Intl throws on (currency: "usdx",
minimumFractionDigits over maximumFractionDigits, month: "numerical", a time
zone the platform does not know): refused at build rather than formatted
differently from the front end.
Fields
UnknownTimeZone(String)
Builder::time_zone names a zone the platform does not know (JS RangeError); without
the tz feature only UTC is known.
Fetch
The fetch closure of ensure_async failed for one file; the catalog is unchanged.
Trait Implementations§
Source§impl Error for Error
impl Error for Error
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()