pub enum Error {
TranslationNode(TranslationNodeError),
PathNotFound(String),
LanguageNotAvailable(Language, String),
}
Expand description
Runtime error re-export.
This use
statement renames
the run time error as a common
error by rust practice and exports
it.
Macro runtime error handling.
Used in translation
invocations for non
compile-time validations and errors.
Use the Display
implementation to obtain the
error message, Self::cause
is available as
a helper method for such purpose. Read it’s
documentation before using.
Variants§
TranslationNode(TranslationNodeError)
Translation node error derivations.
TranslationNode
construction
failure, usually nesting missmatch, invalid
template validation…
Display
directly forwards the inner
error Display
value.
The enum implements
From<TranslationNodeError>
to allow
conversion from
TranslationNodeError
.
Parameters
0
- TheTranslationNodeError
derivation.
PathNotFound(String)
Dynamic path resolve error.
The specified path may not be found in any of the translation files.
This is not related to runtime language
validity, check LanguageNotAvailable
for that purpose.
Parameters
0
- The path that could not be found appended with it’s separator.
LanguageNotAvailable(Language, String)
Dynamic language obtention error.
This specifically happens when a language is not available for a specific translation.
Language parsing is delegated to the user,
the language parameter must be a Language
,
if it’s a &str
the validation is made in compile
time. In that case we don’t reach runtime.
Parameters
0
- The language that is not available.1
- The path for which the language is not available appended with it’s separator.
Implementations§
Source§impl RuntimeError
impl RuntimeError
Sourcepub fn cause(&self) -> String
pub fn cause(&self) -> String
Runtime error display helper.
This method is marked as #[cold]
so it should be called lazily with
monads such as ok_or_else
or any
other or_else
method.
Returns
A heap allocated String
containing
the cause of the error.