pub enum ErroContext7 {
RetryEsgotado {
tentativas: u32,
},
SemChavesApi,
RespostaInvalida {
status: u16,
},
ApiRetornou400 {
mensagem: String,
},
BibliotecaNaoEncontrada {
library_id: String,
},
OperacaoKeysFalhou,
}Expand description
Structured errors for the Context7 API client.
Variants§
RetryEsgotado
All available API keys have been exhausted after the given number of attempts.
SemChavesApi
All keys failed due to authentication errors (401/403).
RespostaInvalida
The API returned an unexpected HTTP status code.
ApiRetornou400
The API returned HTTP 400 with an error message.
BibliotecaNaoEncontrada
The requested library was not found (HTTP 404).
OperacaoKeysFalhou
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 ErroContext7
impl ErroContext7
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 ErroContext7
impl Debug for ErroContext7
Source§impl Display for ErroContext7
impl Display for ErroContext7
Source§impl Error for ErroContext7
impl Error for ErroContext7
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 ErroContext7
impl RefUnwindSafe for ErroContext7
impl Send for ErroContext7
impl Sync for ErroContext7
impl Unpin for ErroContext7
impl UnsafeUnpin for ErroContext7
impl UnwindSafe for ErroContext7
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.