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,
},
UpstreamFailure {
error: Value,
},
Other(String),
}Expand description
Failures that can occur while decoding, encoding, or enforcing policy.
Variants§
InvalidJson(Error)
InvalidType
UnsupportedTranslation
LossyConversion(String)
UnknownField
InvalidValue
UpstreamFailure
The response body reports a failed generation, such as OpenAI Responses
status: "failed". error contains the provider’s error object or a
message explaining that the provider supplied no error details.
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)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()