Skip to content

Commit 76393ee

Browse files
committed
task: Add serialize impl for ApiError
- Adds the `serde::Serialize` derive macro to the `ApiError` type so that this error can be passed along the wire to clients for proxies
1 parent 482344a commit 76393ee

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

async-openai/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "async-openai"
3-
version = "0.28.3"
3+
version = "0.28.4"
44
authors = ["Himanshu Neema"]
55
categories = ["api-bindings", "web-programming", "asynchronous"]
66
keywords = ["openai", "async", "openapi", "ai"]

async-openai/src/error.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//! Errors originating from API calls, parsing responses, and reading-or-writing to the file system.
2-
use serde::Deserialize;
2+
use serde::{Deserialize, Serialize};
33

44
#[derive(Debug, thiserror::Error)]
55
pub enum OpenAIError {
@@ -28,7 +28,7 @@ pub enum OpenAIError {
2828
}
2929

3030
/// OpenAI API returns error object on failure
31-
#[derive(Debug, Deserialize, Clone)]
31+
#[derive(Debug, Serialize, Deserialize, Clone)]
3232
pub struct ApiError {
3333
pub message: String,
3434
pub r#type: Option<String>,

async-openai/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@
103103
//! ```
104104
//! use async_openai::{Client, config::Config, config::OpenAIConfig};
105105
//! unsafe { std::env::set_var("OPENAI_API_KEY", "only for doc test") }
106-
//!
106+
//!
107107
//! let openai_config = OpenAIConfig::default();
108108
//! // You can use `std::sync::Arc` to wrap the config as well
109109
//! let config = Box::new(openai_config) as Box<dyn Config>;

0 commit comments

Comments
 (0)