mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 14:30:45 +00:00
refactor: share provider HTTP error parsing
This commit is contained in:
@@ -9,6 +9,7 @@ import {
|
||||
sanitizeAndNormalizeEmbedding,
|
||||
withRemoteHttpResponse,
|
||||
} from "openclaw/plugin-sdk/memory-core-host-engine-embeddings";
|
||||
import { createProviderHttpError } from "openclaw/plugin-sdk/provider-http";
|
||||
import type { GeminiEmbeddingClient, GeminiTextEmbeddingRequest } from "./embedding-provider.js";
|
||||
|
||||
export type GeminiBatchRequest = {
|
||||
@@ -179,8 +180,7 @@ async function fetchGeminiBatchStatus(params: {
|
||||
},
|
||||
onResponse: async (res) => {
|
||||
if (!res.ok) {
|
||||
const text = await res.text();
|
||||
throw new Error(`gemini batch status failed: ${res.status} ${text}`);
|
||||
throw await createProviderHttpError(res, "gemini batch status failed");
|
||||
}
|
||||
return (await res.json()) as GeminiBatchStatus;
|
||||
},
|
||||
@@ -203,8 +203,7 @@ async function fetchGeminiFileContent(params: {
|
||||
},
|
||||
onResponse: async (res) => {
|
||||
if (!res.ok) {
|
||||
const text = await res.text();
|
||||
throw new Error(`gemini batch file content failed: ${res.status} ${text}`);
|
||||
throw await createProviderHttpError(res, "gemini batch file content failed");
|
||||
}
|
||||
return await res.text();
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user