#[non_exhaustive]pub enum Error {
Show 14 variants
Parse {
format: String,
msg: String,
},
Unsupported(String),
UnknownSegment(String),
Locked(String),
InventedTag(String),
DuplicatedTag(String),
ParserVersion {
found: String,
expected: String,
},
Write(String),
Unwritable {
unit: Option<String>,
reason: String,
},
Limit(LimitError),
Encoding(String),
FormatOption {
key: String,
msg: String,
},
UnknownProfile(String),
Io(Error),
}Expand description
Every Bilingua failure. Match with a wildcard arm: a 1.x release may add variants.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Parse
The bytes are not a file of this format.
Unsupported(String)
No parser for the file, or a feature the format crate does not have.
UnknownSegment(String)
No segment has this id.
Locked(String)
The segment is locked, or belongs to a locked unit.
InventedTag(String)
The target uses a tag the source does not have.
DuplicatedTag(String)
The target uses a tag more often than the source.
ParserVersion
The skeleton comes from another parser or a newer skeleton schema.
Fields
Write(String)
The skeleton is broken or does not belong to this document.
Unwritable
The translation cannot be written in this format: it does not fit (a caption too long), a character has no
code in the file’s code table, or the text would read back as structure (every letter swallowed by a
placeholder). The document itself is fine; the translator has to change the text. unit names the unit when
one is to blame; reason is plain text (LocOS’s message where LocOS has one), safe to show the translator, and
is also the whole Display text.
Write stays for a broken or foreign skeleton.
Fields
Limit(LimitError)
The file is over a safety limit or holds something unsafe (a zip bomb, an XML entity bomb, too many units). The message is short, names the limit and is safe to show the person who uploaded the file.
Encoding(String)
The bytes cannot be read as text in any encoding Bilingua knows.
FormatOption
A format_options key no format declares, or a value of the wrong kind.
UnknownProfile(String)
A profile name Bilingua does not know (see profile::profiles).
Io(Error)
An I/O error from a reader (Bilingua itself reads no files).
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()