pub enum TranslationError {
InvalidJson(Error),
InvalidType {
path: String,
expected: &'static str,
},
UnsupportedTranslation {
from: FormatId,
to: FormatId,
},
LossyConversion(String),
UnknownField {
path: String,
},
InvalidValue {
path: String,
message: String,
},
Other(String),
}Expand description
Failures that can occur while decoding, encoding, or enforcing policy.
Variants§
InvalidJson(Error)
InvalidType
UnsupportedTranslation
LossyConversion(String)
UnknownField
InvalidValue
Other(String)
Implementations§
Source§impl TranslationError
impl TranslationError
Sourcepub const fn kind(&self) -> &'static str
pub const fn kind(&self) -> &'static str
Returns the stable variant name for FFI and language-binding errors.
Sourcepub fn unsupported_role(path: impl Into<String>, value: &str) -> Self
pub fn unsupported_role(path: impl Into<String>, value: &str) -> Self
Builds an TranslationError::InvalidValue for an unsupported message
role. A transparent router must reject the same payloads the upstream
provider would: an unknown role string (e.g. "api") should surface as
an invalid_value-style error rather than being silently coerced to
user. path is a JSON-path pointer to the offending field so the
error reads like a provider validation error.
Trait Implementations§
Source§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
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
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
fn description(&self) -> &str
👎Deprecated since 1.42.0:
use the Display impl or to_string()
Auto Trait Implementations§
impl !RefUnwindSafe for TranslationError
impl !UnwindSafe for TranslationError
impl Freeze for TranslationError
impl Send for TranslationError
impl Sync for TranslationError
impl Unpin for TranslationError
impl UnsafeUnpin for TranslationError
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more