mirror of
https://github.com/openai/codex.git
synced 2026-04-26 15:45:02 +00:00
[core] add optional status_code to error events (#6865)
We want to better uncover error status code for clients. Add an optional
status_code to error events (thread error, error, stream error) so app
server could uncover the status code from the client side later.
in event log:
```
< {
< "method": "codex/event/stream_error",
< "params": {
< "conversationId": "019a9a32-f576-7292-9711-8e57e8063536",
< "id": "0",
< "msg": {
< "message": "Reconnecting... 5/5",
< "status_code": 401,
< "type": "stream_error"
< }
< }
< }
< {
< "method": "codex/event/error",
< "params": {
< "conversationId": "019a9a32-f576-7292-9711-8e57e8063536",
< "id": "0",
< "msg": {
< "message": "exceeded retry limit, last status: 401 Unauthorized, request id: 9a0cb03a485067f7-SJC",
< "status_code": 401,
< "type": "error"
< }
< }
< }
```
This commit is contained in:
@@ -686,6 +686,8 @@ pub struct ExitedReviewModeEvent {
|
||||
#[derive(Debug, Clone, Deserialize, Serialize, JsonSchema, TS)]
|
||||
pub struct ErrorEvent {
|
||||
pub message: String,
|
||||
#[serde(default)]
|
||||
pub http_status_code: Option<u16>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Deserialize, Serialize, JsonSchema, TS)]
|
||||
@@ -1363,6 +1365,8 @@ pub struct UndoCompletedEvent {
|
||||
#[derive(Debug, Clone, Deserialize, Serialize, JsonSchema, TS)]
|
||||
pub struct StreamErrorEvent {
|
||||
pub message: String,
|
||||
#[serde(default)]
|
||||
pub http_status_code: Option<u16>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Deserialize, Serialize, JsonSchema, TS)]
|
||||
|
||||
Reference in New Issue
Block a user