#[non_exhaustive]pub struct ApiFailure {
pub error_type: Option<String>,
pub code: Option<String>,
pub status: Option<u64>,
}Expand description
A structured API error carried by a terminal turn.failed event.
Codex nests the upstream API error as a JSON document inside the
error.message string rather than as sibling fields, so reaching the code
means parsing that string. Captured from codex-cli 0.149.0:
{"type":"turn.failed","error":{"message":"{\n \"type\": \"error\",
\n \"error\": {\n \"type\": \"invalid_request_error\",
\n \"code\": \"invalid_json_schema\", ... },\n \"status\": 400\n}"}}Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.error_type: Option<String>The API error class, such as invalid_request_error.
code: Option<String>The machine-readable code, such as invalid_json_schema.
status: Option<u64>The HTTP status the API returned, such as 400.
Implementations§
Source§impl ApiFailure
impl ApiFailure
Sourcepub fn rejected_request(&self) -> bool
pub fn rejected_request(&self) -> bool
Whether the API rejected the request itself, before generation.
A 4xx status other than 429 means the request was refused rather than throttled or failed midway.
Trait Implementations§
Source§impl Clone for ApiFailure
impl Clone for ApiFailure
Source§impl Debug for ApiFailure
impl Debug for ApiFailure
Source§impl Default for ApiFailure
impl Default for ApiFailure
impl Eq for ApiFailure
Source§impl PartialEq for ApiFailure
impl PartialEq for ApiFailure
impl StructuralPartialEq for ApiFailure
Auto Trait Implementations§
impl Forget for ApiFailure
impl Freeze for ApiFailure
impl Move for ApiFailure
impl RefUnwindSafe for ApiFailure
impl Send for ApiFailurewhere
RawVecInner: Send,
impl Sync for ApiFailurewhere
RawVecInner: Sync,
impl Unpin for ApiFailure
impl UnsafeUnpin for ApiFailure
impl UnwindSafe for ApiFailurewhere
RawVecInner: UnwindSafe,
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