pub enum Error {
Api(ApiError),
Http(Error),
Json(Error),
Internal(String),
}Expand description
Top-level error type for the Todoist API client.
This wraps all possible errors that can occur when using the client, including API-specific errors, network errors, and serialization errors.
Variants§
Api(ApiError)
An API-specific error (auth failure, rate limiting, validation, etc.)
Http(Error)
An HTTP request/response error from reqwest.
Json(Error)
JSON serialization/deserialization error.
Internal(String)
Internal/unexpected error.
Implementations§
Source§impl Error
impl Error
Sourcepub fn is_retryable(&self) -> bool
pub fn is_retryable(&self) -> bool
Returns true if this error is potentially retryable.
Sourcepub fn is_invalid_sync_token(&self) -> bool
pub fn is_invalid_sync_token(&self) -> bool
Returns true if this error indicates an invalid sync token.
This is used to detect when the API rejects a sync token, which
means the client should fall back to a full sync with sync_token='*'.
Sourcepub fn exit_code(&self) -> i32
pub fn exit_code(&self) -> i32
Returns the appropriate CLI exit code for this error.
Exit codes follow the spec:
- 2: API error (auth failure, not found, validation error)
- 3: Network error (connection failed, timeout)
- 4: Rate limited (with retry-after information)
Sourcepub fn as_api_error(&self) -> Option<&ApiError>
pub fn as_api_error(&self) -> Option<&ApiError>
Returns the underlying API error if this is an API error variant.
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
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> 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> 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> 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.