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 + Sync + Send>>,
},
InternalServer {
message: String,
request_id: Option<String>,
},
ServiceUnavailable {
message: String,
retry_after: Option<u64>,
},
Serialization {
message: String,
source: Option<Arc<dyn Error + Sync + Send>>,
},
Io {
message: String,
source: Arc<Error>,
},
HttpClient {
message: String,
source: Option<Arc<dyn Error + Sync + Send>>,
},
Validation {
message: String,
param: Option<String>,
},
Url {
message: String,
source: Option<ParseError>,
},
Streaming {
message: String,
source: Option<Arc<dyn Error + Sync + Send>>,
},
Encoding {
message: String,
source: Option<Arc<dyn Error + Sync + Send>>,
},
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 + Sync + Send>>,
) -> Error
pub fn connection( message: impl Into<String>, source: Option<Box<dyn Error + Sync + Send>>, ) -> 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 + Sync + Send>>,
) -> Error
pub fn serialization( message: impl Into<String>, source: Option<Box<dyn Error + Sync + Send>>, ) -> Error
Creates a new serialization error.
Sourcepub fn http_client(
message: impl Into<String>,
source: Option<Box<dyn Error + Sync + Send>>,
) -> Error
pub fn http_client( message: impl Into<String>, source: Option<Box<dyn Error + Sync + Send>>, ) -> 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 + Sync + Send>>,
) -> Error
pub fn streaming( message: impl Into<String>, source: Option<Box<dyn Error + Sync + Send>>, ) -> Error
Creates a new streaming error.
Sourcepub fn encoding(
message: impl Into<String>,
source: Option<Box<dyn Error + Sync + Send>>,
) -> Error
pub fn encoding( message: impl Into<String>, source: Option<Box<dyn Error + Sync + Send>>, ) -> 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 !RefUnwindSafe for Error
impl !UnwindSafe for Error
impl Freeze for Error
impl Send for Error
impl Sync for Error
impl Unpin for Error
impl UnsafeUnpin 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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FmtForward for T
impl<T> FmtForward for T
Source§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self to use its Binary implementation when Debug-formatted.Source§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self to use its Display implementation when
Debug-formatted.Source§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self to use its LowerExp implementation when
Debug-formatted.Source§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self to use its LowerHex implementation when
Debug-formatted.Source§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self to use its Octal implementation when Debug-formatted.Source§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self to use its Pointer implementation when
Debug-formatted.Source§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self to use its UpperExp implementation when
Debug-formatted.Source§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self to use its UpperHex implementation when
Debug-formatted.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 moreimpl<T> MaybeSend for Twhere
T: Send,
Source§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.Source§impl<T> ToCompactString for Twhere
T: Display,
impl<T> ToCompactString for Twhere
T: Display,
Source§fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
ToCompactString::to_compact_string() Read moreSource§fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
CompactString. Read more