pub enum CoreError {
InvalidInput(String),
UrlParse(ParseError),
Http(Error),
HttpResponse(HttpErrorInfo),
Authentication(String),
Validation(String),
UsageLimit(UsageLimitInfo),
Job(JobErrorInfo),
Config(String),
Timeout(String),
Protocol(String),
Internal(String),
}Expand description
Unified error enum for all Synth core errors.
This provides a single error type that can be mapped to language-specific exceptions in Python, TypeScript, etc.
Variants§
InvalidInput(String)
Invalid input provided
UrlParse(ParseError)
URL parsing failed
Http(Error)
HTTP request failed (network layer)
HttpResponse(HttpErrorInfo)
HTTP response error (4xx/5xx)
Authentication(String)
Authentication failed
Validation(String)
Validation error
UsageLimit(UsageLimitInfo)
Usage/rate limit exceeded
Job(JobErrorInfo)
Job operation failed
Config(String)
Configuration error
Timeout(String)
Timeout error
Protocol(String)
Protocol/wire format error
Internal(String)
Generic internal error
Implementations§
Source§impl CoreError
impl CoreError
Sourcepub fn http_response(
status: u16,
url: &str,
message: &str,
body: Option<&str>,
) -> Self
pub fn http_response( status: u16, url: &str, message: &str, body: Option<&str>, ) -> Self
Create an HTTP response error.
Sourcepub fn validation(message: impl Into<String>) -> Self
pub fn validation(message: impl Into<String>) -> Self
Create a validation error.
Sourcepub fn usage_limit(
limit_type: &str,
api: &str,
current: f64,
limit: f64,
tier: &str,
retry_after: Option<i64>,
) -> Self
pub fn usage_limit( limit_type: &str, api: &str, current: f64, limit: f64, tier: &str, retry_after: Option<i64>, ) -> Self
Create a usage limit error.
Sourcepub fn is_auth_error(&self) -> bool
pub fn is_auth_error(&self) -> bool
Check if this is an authentication error.
Sourcepub fn is_rate_limit(&self) -> bool
pub fn is_rate_limit(&self) -> bool
Check if this is a rate limit error.
Sourcepub fn is_retryable(&self) -> bool
pub fn is_retryable(&self) -> bool
Check if this is a retryable error (5xx, timeout, network).
Sourcepub fn http_status(&self) -> Option<u16>
pub fn http_status(&self) -> Option<u16>
Get HTTP status code if this is an HTTP error.
Trait Implementations§
Source§impl Error for CoreError
impl Error for CoreError
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()
Source§impl From<ParseError> for CoreError
impl From<ParseError> for CoreError
Source§fn from(source: ParseError) -> Self
fn from(source: ParseError) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for CoreError
impl !RefUnwindSafe for CoreError
impl Send for CoreError
impl Sync for CoreError
impl Unpin for CoreError
impl !UnwindSafe for CoreError
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::RequestSource§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.