pub enum Error {
Show 20 variants
Api {
status_code: u16,
error_type: Option<String>,
message: String,
request_id: Option<String>,
},
Authentication {
message: String,
},
Permission {
message: String,
},
NotFound {
message: String,
resource_type: Option<String>,
resource_id: Option<String>,
},
RateLimit {
message: String,
retry_after: Option<u64>,
},
BadRequest {
message: String,
param: Option<String>,
},
Timeout {
message: String,
duration: Option<f64>,
},
Abort {
message: String,
},
Connection {
message: String,
source: Option<Arc<dyn Error + Send + Sync>>,
},
InternalServer {
message: String,
request_id: Option<String>,
},
ServiceUnavailable {
message: String,
retry_after: Option<u64>,
},
Serialization {
message: String,
source: Option<Arc<dyn Error + Send + Sync>>,
},
Io {
message: String,
source: Arc<Error>,
},
HttpClient {
message: String,
source: Option<Arc<dyn Error + Send + Sync>>,
},
Validation {
message: String,
param: Option<String>,
},
Url {
message: String,
source: Option<ParseError>,
},
Streaming {
message: String,
source: Option<Arc<dyn Error + Send + Sync>>,
},
Encoding {
message: String,
source: Option<Arc<dyn Error + Send + Sync>>,
},
Unknown {
message: String,
},
ToDo {
message: String,
},
}anthropic-client only.Expand description
The main error type for the adk-anthropic client.
Variants§
Api
A generic API error occurred.
Fields
Authentication
Authentication error.
Permission
Authorization/Permission error.
NotFound
Resource not found.
Fields
RateLimit
Rate limit exceeded.
Fields
BadRequest
Bad request due to invalid parameters.
Fields
Timeout
API timeout error.
Fields
Abort
Request was aborted by the client.
Connection
Connection error.
Fields
InternalServer
Server returned a 500 internal error.
Fields
Server is overloaded or unavailable.
Serialization
Error during JSON serialization or deserialization.
Fields
Io
I/O error.
HttpClient
HTTP client error.
Fields
Validation
Error during validation of request parameters.
Fields
Url
A URL parsing or manipulation error.
Fields
source: Option<ParseError>The underlying error.
Streaming
A streaming error occurred.
Fields
Encoding
Encoding/decoding error.
Fields
Unknown
Unknown error.
ToDo
Unimplemented functionality.
Implementations§
Source§impl Error
impl Error
Sourcepub fn api(
status_code: u16,
error_type: Option<String>,
message: String,
request_id: Option<String>,
) -> Error
pub fn api( status_code: u16, error_type: Option<String>, message: String, request_id: Option<String>, ) -> Error
Creates a new API error.
Sourcepub fn authentication(message: impl Into<String>) -> Error
pub fn authentication(message: impl Into<String>) -> Error
Creates a new authentication error.
Sourcepub fn permission(message: impl Into<String>) -> Error
pub fn permission(message: impl Into<String>) -> Error
Creates a new permission error.
Sourcepub fn not_found(
message: impl Into<String>,
resource_type: Option<String>,
resource_id: Option<String>,
) -> Error
pub fn not_found( message: impl Into<String>, resource_type: Option<String>, resource_id: Option<String>, ) -> Error
Creates a new not found error.
Sourcepub fn rate_limit(message: impl Into<String>, retry_after: Option<u64>) -> Error
pub fn rate_limit(message: impl Into<String>, retry_after: Option<u64>) -> Error
Creates a new rate limit error.
Sourcepub fn bad_request(message: impl Into<String>, param: Option<String>) -> Error
pub fn bad_request(message: impl Into<String>, param: Option<String>) -> Error
Creates a new bad request error.
Sourcepub fn timeout(message: impl Into<String>, duration: Option<f64>) -> Error
pub fn timeout(message: impl Into<String>, duration: Option<f64>) -> Error
Creates a new timeout error.
Sourcepub fn connection(
message: impl Into<String>,
source: Option<Box<dyn Error + Send + Sync>>,
) -> Error
pub fn connection( message: impl Into<String>, source: Option<Box<dyn Error + Send + Sync>>, ) -> Error
Creates a new connection error.
Sourcepub fn internal_server(
message: impl Into<String>,
request_id: Option<String>,
) -> Error
pub fn internal_server( message: impl Into<String>, request_id: Option<String>, ) -> Error
Creates a new internal server error.
Creates a new service unavailable error.
Sourcepub fn serialization(
message: impl Into<String>,
source: Option<Box<dyn Error + Send + Sync>>,
) -> Error
pub fn serialization( message: impl Into<String>, source: Option<Box<dyn Error + Send + Sync>>, ) -> Error
Creates a new serialization error.
Sourcepub fn http_client(
message: impl Into<String>,
source: Option<Box<dyn Error + Send + Sync>>,
) -> Error
pub fn http_client( message: impl Into<String>, source: Option<Box<dyn Error + Send + Sync>>, ) -> Error
Creates a new HTTP client error.
Sourcepub fn validation(message: impl Into<String>, param: Option<String>) -> Error
pub fn validation(message: impl Into<String>, param: Option<String>) -> Error
Creates a new validation error.
Sourcepub fn url(message: impl Into<String>, source: Option<ParseError>) -> Error
pub fn url(message: impl Into<String>, source: Option<ParseError>) -> Error
Creates a new URL error.
Sourcepub fn streaming(
message: impl Into<String>,
source: Option<Box<dyn Error + Send + Sync>>,
) -> Error
pub fn streaming( message: impl Into<String>, source: Option<Box<dyn Error + Send + Sync>>, ) -> Error
Creates a new streaming error.
Sourcepub fn encoding(
message: impl Into<String>,
source: Option<Box<dyn Error + Send + Sync>>,
) -> Error
pub fn encoding( message: impl Into<String>, source: Option<Box<dyn Error + Send + Sync>>, ) -> Error
Creates a new encoding error.
Sourcepub fn todo(message: impl Into<String>) -> Error
pub fn todo(message: impl Into<String>) -> Error
Creates a new ToDo error for unimplemented functionality.
Sourcepub fn is_authentication(&self) -> bool
pub fn is_authentication(&self) -> bool
Returns true if this error is related to authentication.
Sourcepub fn is_permission(&self) -> bool
pub fn is_permission(&self) -> bool
Returns true if this error is related to permissions.
Sourcepub fn is_not_found(&self) -> bool
pub fn is_not_found(&self) -> bool
Returns true if this error is a “not found” error.
Sourcepub fn is_rate_limit(&self) -> bool
pub fn is_rate_limit(&self) -> bool
Returns true if this error is related to rate limiting.
Sourcepub fn is_bad_request(&self) -> bool
pub fn is_bad_request(&self) -> bool
Returns true if this error is a bad request.
Sourcepub fn is_timeout(&self) -> bool
pub fn is_timeout(&self) -> bool
Returns true if this error is a timeout.
Sourcepub fn is_connection(&self) -> bool
pub fn is_connection(&self) -> bool
Returns true if this error is a connection error.
Sourcepub fn is_server_error(&self) -> bool
pub fn is_server_error(&self) -> bool
Returns true if this error is a server error.
Sourcepub fn is_retryable(&self) -> bool
pub fn is_retryable(&self) -> bool
Returns true if this error is retryable.
Sourcepub fn is_validation(&self) -> bool
pub fn is_validation(&self) -> bool
Returns true if this error is a validation error.
Sourcepub fn request_id(&self) -> Option<&str>
pub fn request_id(&self) -> Option<&str>
Returns the request ID associated with this error, if any.
Sourcepub fn status_code(&self) -> Option<u16>
pub fn status_code(&self) -> Option<u16>
Returns the status code associated with this error, if any.
Trait Implementations§
Source§impl Error for Error
impl Error for Error
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<ParseError> for Error
impl From<ParseError> for Error
Source§fn from(err: ParseError) -> Error
fn from(err: ParseError) -> Error
Auto Trait Implementations§
impl Freeze for Error
impl !RefUnwindSafe for Error
impl Send for Error
impl Sync for Error
impl Unpin for Error
impl UnsafeUnpin for Error
impl !UnwindSafe for Error
Blanket Implementations§
Source§impl<T> AsErrorSource for Twhere
T: Error + 'static,
impl<T> AsErrorSource for Twhere
T: Error + 'static,
Source§fn as_error_source(&self) -> &(dyn Error + 'static)
fn as_error_source(&self) -> &(dyn Error + 'static)
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
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.