pub enum Context7Error {
RetriesExhausted {
attempts: u32,
},
NoValidApiKey,
InvalidResponse {
status: u16,
},
ApiReturned400 {
message: String,
},
LibraryNotFound {
library_id: String,
},
KeysOperationFailed,
}Expand description
Structured errors for the Context7 API client.
Variants§
RetriesExhausted
All available API keys have been exhausted after the given number of attempts.
NoValidApiKey
All keys failed due to authentication errors (401/403).
InvalidResponse
The API returned an unexpected HTTP status code.
ApiReturned400
The API returned HTTP 400 with an error message.
LibraryNotFound
The requested library was not found (HTTP 404).
KeysOperationFailed
A keys operation failed (e.g., invalid index, no keys stored). The caller already printed a user-friendly message; this signals exit code 1.
Implementations§
Source§impl Context7Error
impl Context7Error
Sourcepub fn exit_code(&self) -> i32
pub fn exit_code(&self) -> i32
Maps each error variant to a BSD-style exit code (sysexits.h).
| Code | Constant | Meaning |
|---|---|---|
| 1 | generic | Unspecified runtime error |
| 65 | EX_DATAERR | Invalid input data |
| 66 | EX_NOINPUT | Requested resource not found |
| 69 | EX_UNAVAILABLE | Service unavailable after retry |
| 74 | EX_IOERR | I/O or network error |
| 77 | EX_NOPERM | Permission / authentication denied |
Trait Implementations§
Source§impl Debug for Context7Error
impl Debug for Context7Error
Source§impl Display for Context7Error
impl Display for Context7Error
Source§impl Error for Context7Error
impl Error for Context7Error
1.30.0 · 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()
Auto Trait Implementations§
impl Freeze for Context7Error
impl RefUnwindSafe for Context7Error
impl Send for Context7Error
impl Sync for Context7Error
impl Unpin for Context7Error
impl UnsafeUnpin for Context7Error
impl UnwindSafe for Context7Error
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> 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.