pub enum TranslationError {
InvalidArgument(String),
UnavailableOnThisMacOS(String),
TimedOut(String),
UnsupportedSourceLanguage(String),
UnsupportedTargetLanguage(String),
UnsupportedLanguagePairing(String),
UnableToIdentifyLanguage(String),
NothingToTranslate(String),
AlreadyCancelled(String),
NotInstalled(String),
Framework(String),
Unknown(String),
}Expand description
Enumerates failures reported by Translation.framework and the Swift bridge.
Variants§
InvalidArgument(String)
An argument failed validation before reaching the framework.
Translation.framework is unavailable on the current macOS version.
TimedOut(String)
The framework operation timed out.
UnsupportedSourceLanguage(String)
The source language is unsupported by Translation.framework.
UnsupportedTargetLanguage(String)
The target language is unsupported by Translation.framework.
UnsupportedLanguagePairing(String)
The source and target pairing is unsupported by Translation.framework.
UnableToIdentifyLanguage(String)
The framework could not identify the input language.
NothingToTranslate(String)
The request contained no translatable content.
AlreadyCancelled(String)
The session was already cancelled.
NotInstalled(String)
Required translation resources are not installed.
Framework(String)
The Swift bridge or Translation.framework returned an underlying error.
Unknown(String)
An unknown status or payload was returned by the bridge.
Implementations§
Source§impl TranslationError
impl TranslationError
Sourcepub fn error_description(&self) -> &str
pub fn error_description(&self) -> &str
Returns the primary error description from the framework payload.
Sourcepub fn failure_reason(&self) -> Option<&str>
pub fn failure_reason(&self) -> Option<&str>
Returns the framework failure reason, when one was provided.
Trait Implementations§
Source§impl Clone for TranslationError
impl Clone for TranslationError
Source§fn clone(&self) -> TranslationError
fn clone(&self) -> TranslationError
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for TranslationError
impl Debug for TranslationError
Source§impl Display for TranslationError
impl Display for TranslationError
Source§impl Error for TranslationError
impl Error for TranslationError
1.30.0 · 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()
Source§impl PartialEq for TranslationError
impl PartialEq for TranslationError
Source§fn eq(&self, other: &TranslationError) -> bool
fn eq(&self, other: &TranslationError) -> bool
self and other values to be equal, and is used by ==.