Skip to main content

Error

Enum Error 

Source
#[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
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

Io

A file or directory could not be read.

Fields

§path: String

The path as given (a dir entry is joined to its directory).

§source: Error

What the OS said.

§

Json

A locale file, messages text or i18n.json is not valid JSON.

Fields

§path: String

The file path, or messages:<locale>/<page> for text passed in code.

§offset: usize

Byte offset of the problem (a BOM counts).

§kind: &'static str

What is wrong there.

§

NotObject

Valid JSON, but not an object (an array, null, a string…).

Fields

§path: String

The file path, or messages:<locale>/<page>.

§

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

§path: String

The config path, or i18n.json for config_json.

§reason: &'static str

Which field is wrong.

§

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

§locale: String

The locale code the format is listed under.

§name: String

The format’s name.

§option: String

The option (signDisplay, notation, maximumFractionDigits…).

§

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.

Fields

§path: String

The manifest path that was being fetched.

§message: String

What the closure’s error said (its Display).

Trait Implementations§

Source§

impl Debug for Error

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for Error

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Error for Error

Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0:

use the Display impl or to_string()

1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more

Auto Trait Implementations§

§

impl !RefUnwindSafe for Error

§

impl !UnwindSafe for Error

§

impl Forget for Error

§

impl Freeze for Error

§

impl Move for Error

§

impl Send for Error

§

impl Sync for Error

§

impl Unpin for Error

§

impl UnsafeUnpin for Error

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.