Remove dead code and fix typo

- Remove unused AUTH_SCOPE constant from client.rs
- Remove unused ErrorType, ErrorInfoMetadata, FieldViolation,
  and Link types from types/error.rs
- Fix "EventSourrce" typo in error.rs Display impl
This commit is contained in:
2026-01-30 20:29:55 +00:00
parent 4c156fbb33
commit eb38c65ac5
3 changed files with 6 additions and 38 deletions

View File

@@ -6,8 +6,6 @@ use tokio_stream::{Stream, StreamExt};
use tokio_util::codec::LinesCodecError;
use tracing::error;
pub static AUTH_SCOPE: &[&str] = &["https://www.googleapis.com/auth/cloud-platform"];
#[derive(Clone, Debug)]
pub struct GeminiClient {
client: reqwest::Client,

View File

@@ -34,7 +34,7 @@ impl Display for Error {
write!(f, "No candidates returned for the prompt")
}
Error::EventSourceError(e) => {
write!(f, "EventSourrce Error: {e}")
write!(f, "EventSource Error: {e}")
}
Error::EventSourceClosedError => {
write!(f, "EventSource closed error")

View File

@@ -26,42 +26,12 @@ pub struct GeminiApiError {
impl core::fmt::Display for GeminiApiError {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), std::fmt::Error> {
write!(f, "Gemini API Error {} - {}", self.error.code, self.error.message)
write!(
f,
"Gemini API Error {} - {}",
self.error.code, self.error.message
)
}
}
impl std::error::Error for GeminiApiError {}
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct Link {
pub description: String,
pub url: String,
}
#[derive(Clone, Debug, Serialize, Deserialize)]
#[serde(tag = "@type")]
pub enum ErrorType {
#[serde(rename = "type.googleapis.com/google.rpc.ErrorInfo")]
ErrorInfo { metadata: ErrorInfoMetadata },
#[serde(rename = "type.googleapis.com/google.rpc.Help")]
Help { links: Vec<Link> },
#[serde(rename = "type.googleapis.com/google.rpc.BadRequest")]
BadRequest {
#[serde(rename = "fieldViolations")]
field_violations: Vec<FieldViolation>,
},
}
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct ErrorInfoMetadata {
pub service: String,
pub consumer: String,
}
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct FieldViolation {
pub field: String,
pub description: String,
}