pub enum GatewayError {
Show 18 variants
Config(String),
Storage(String),
HttpClient(Error),
Serialization(String),
Io(Error),
Auth(String),
Provider(ProviderError),
RateLimit {
message: String,
retry_after: Option<u64>,
rpm_limit: Option<u32>,
tpm_limit: Option<u32>,
},
Validation(String),
Timeout(String),
NotFound(String),
Conflict(String),
BadRequest(String),
Internal(String),
Unavailable(String),
Network(String),
Forbidden(String),
NotImplemented(String),
}Expand description
Main error type for the Gateway
Consolidated from ~36 variants to 15 semantic categories. Each variant maps to a distinct HTTP status code or error class.
Variants§
Config(String)
Configuration errors
Storage(String)
Storage errors (database, cache, Redis, vector DB, S3)
HttpClient(Error)
HTTP client errors
Serialization(String)
Serialization/deserialization errors (JSON, YAML, etc.)
Io(Error)
IO errors (file system, local file storage)
Auth(String)
Authentication and cryptographic errors (auth, JWT, crypto)
Provider(ProviderError)
Provider errors
RateLimit
Rate limiting errors with structured metadata
Validation(String)
Validation and parsing errors
Timeout(String)
Timeout errors
NotFound(String)
Not found errors
Conflict(String)
Conflict errors
BadRequest(String)
Bad request errors
Internal(String)
Internal server errors
Service unavailable (provider unavailable, circuit breaker, no healthy providers)
Network(String)
Network errors (connectivity, external services, WebSocket)
Forbidden(String)
Forbidden errors
NotImplemented(String)
Not implemented errors
Implementations§
Source§impl GatewayError
Helper functions for creating specific errors
impl GatewayError
Helper functions for creating specific errors
pub fn auth<S: Into<String>>(message: S) -> Self
pub fn bad_request<S: Into<String>>(message: S) -> Self
pub fn not_found<S: Into<String>>(message: S) -> Self
pub fn conflict<S: Into<String>>(message: S) -> Self
pub fn internal<S: Into<String>>(message: S) -> Self
pub fn validation<S: Into<String>>(message: S) -> Self
pub fn rate_limit<S: Into<String>>(message: S) -> Self
pub fn timeout<S: Into<String>>(message: S) -> Self
pub fn server<S: Into<String>>(message: S) -> Self
pub fn network<S: Into<String>>(message: S) -> Self
pub fn external_service<S: Into<String>>(message: S) -> Self
pub fn invalid_request<S: Into<String>>(message: S) -> Self
pub fn parsing<S: Into<String>>(message: S) -> Self
pub fn alert<S: Into<String>>(message: S) -> Self
pub fn not_implemented<S: Into<String>>(message: S) -> Self
pub fn forbidden<S: Into<String>>(message: S) -> Self
pub fn external<S: Into<String>>(message: S) -> Self
pub fn invalid_request_error<S: Into<String>>(message: S) -> Self
pub fn no_providers_available<S: Into<String>>(message: S) -> Self
pub fn provider_not_found<S: Into<String>>(message: S) -> Self
pub fn no_providers_for_model<S: Into<String>>(message: S) -> Self
pub fn no_healthy_providers<S: Into<String>>(message: S) -> Self
Trait Implementations§
Source§impl CanonicalError for GatewayError
impl CanonicalError for GatewayError
fn canonical_code(&self) -> ErrorCode
fn canonical_retryable(&self) -> bool
Source§impl Debug for GatewayError
impl Debug for GatewayError
Source§impl Display for GatewayError
impl Display for GatewayError
Source§impl Error for GatewayError
impl Error for GatewayError
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 From<A2AError> for GatewayError
impl From<A2AError> for GatewayError
Source§impl From<DbErr> for GatewayError
Available on crate feature storage only.
impl From<DbErr> for GatewayError
storage only.Source§impl From<Error> for GatewayError
impl From<Error> for GatewayError
Source§impl From<Error> for GatewayError
impl From<Error> for GatewayError
Source§impl From<Error> for GatewayError
impl From<Error> for GatewayError
Source§impl From<Error> for GatewayError
impl From<Error> for GatewayError
Source§impl From<Error> for GatewayError
impl From<Error> for GatewayError
Source§impl From<GatewayError> for AsyncBatchError
impl From<GatewayError> for AsyncBatchError
Source§fn from(err: GatewayError) -> Self
fn from(err: GatewayError) -> Self
Source§impl From<GatewayError> for SDKError
Error
impl From<GatewayError> for SDKError
Error
Source§fn from(error: GatewayError) -> Self
fn from(error: GatewayError) -> Self
Source§impl From<McpError> for GatewayError
impl From<McpError> for GatewayError
Source§impl From<ProviderError> for GatewayError
impl From<ProviderError> for GatewayError
Source§fn from(err: ProviderError) -> Self
fn from(err: ProviderError) -> Self
Source§impl From<RedisError> for GatewayError
Available on crate feature redis only.
impl From<RedisError> for GatewayError
redis only.Source§fn from(err: RedisError) -> Self
fn from(err: RedisError) -> Self
Source§impl ResponseError for GatewayError
impl ResponseError for GatewayError
Source§fn error_response(&self) -> HttpResponse
fn error_response(&self) -> HttpResponse
Source§fn status_code(&self) -> StatusCode
fn status_code(&self) -> StatusCode
Auto Trait Implementations§
impl Freeze for GatewayError
impl !RefUnwindSafe for GatewayError
impl Send for GatewayError
impl Sync for GatewayError
impl Unpin for GatewayError
impl UnsafeUnpin for GatewayError
impl !UnwindSafe for GatewayError
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
Source§impl<T> BudgetAwareRouting for T
impl<T> BudgetAwareRouting for T
Source§fn filter_by_budget(
&self,
providers: Vec<String>,
budget_router: &BudgetAwareRouter,
) -> Vec<String>
fn filter_by_budget( &self, providers: Vec<String>, budget_router: &BudgetAwareRouter, ) -> Vec<String>
Source§impl<T> Injectable for T
impl<T> Injectable for T
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>
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>
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> Pointable for T
impl<T> Pointable for T
Source§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.