From 940e62772e68c99cd4cb0b037acf5c16c23e0854 Mon Sep 17 00:00:00 2001 From: Bruce MacDonald Date: Tue, 26 Nov 2024 16:08:09 -0800 Subject: [PATCH] openai: remove unused error code (#7850) The writeError takes a code argument which is no longer used. Remove it for clarity. --- openai/openai.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/openai/openai.go b/openai/openai.go index 2bf9b9f9..10e5b09e 100644 --- a/openai/openai.go +++ b/openai/openai.go @@ -571,7 +571,7 @@ type EmbedWriter struct { model string } -func (w *BaseWriter) writeError(code int, data []byte) (int, error) { +func (w *BaseWriter) writeError(data []byte) (int, error) { var serr api.StatusError err := json.Unmarshal(data, &serr) if err != nil { @@ -630,7 +630,7 @@ func (w *ChatWriter) writeResponse(data []byte) (int, error) { func (w *ChatWriter) Write(data []byte) (int, error) { code := w.ResponseWriter.Status() if code != http.StatusOK { - return w.writeError(code, data) + return w.writeError(data) } return w.writeResponse(data) @@ -679,7 +679,7 @@ func (w *CompleteWriter) writeResponse(data []byte) (int, error) { func (w *CompleteWriter) Write(data []byte) (int, error) { code := w.ResponseWriter.Status() if code != http.StatusOK { - return w.writeError(code, data) + return w.writeError(data) } return w.writeResponse(data) @@ -704,7 +704,7 @@ func (w *ListWriter) writeResponse(data []byte) (int, error) { func (w *ListWriter) Write(data []byte) (int, error) { code := w.ResponseWriter.Status() if code != http.StatusOK { - return w.writeError(code, data) + return w.writeError(data) } return w.writeResponse(data) @@ -730,7 +730,7 @@ func (w *RetrieveWriter) writeResponse(data []byte) (int, error) { func (w *RetrieveWriter) Write(data []byte) (int, error) { code := w.ResponseWriter.Status() if code != http.StatusOK { - return w.writeError(code, data) + return w.writeError(data) } return w.writeResponse(data) @@ -755,7 +755,7 @@ func (w *EmbedWriter) writeResponse(data []byte) (int, error) { func (w *EmbedWriter) Write(data []byte) (int, error) { code := w.ResponseWriter.Status() if code != http.StatusOK { - return w.writeError(code, data) + return w.writeError(data) } return w.writeResponse(data)