Merge pull request #5832 from stephanmck/fix/provider-error-body-passthrough-5763

fix(ai): surface provider HTTP error body instead of opaque SDK message
This commit is contained in:
Mario Zechner
2026-06-29 16:58:24 +02:00
committed by GitHub
12 changed files with 580 additions and 36 deletions
+2 -1
View File
@@ -24,6 +24,7 @@ import type {
ThinkingContent,
ToolCall,
} from "../types.ts";
import { formatProviderError, normalizeProviderError } from "../utils/error-body.ts";
import { AssistantMessageEventStream } from "../utils/event-stream.ts";
import { providerHeadersToRecord } from "../utils/headers.ts";
import { getProviderEnvValue } from "../utils/provider-env.ts";
@@ -288,7 +289,7 @@ export const stream: StreamFunction<"google-vertex", GoogleVertexOptions> = (
}
}
output.stopReason = options?.signal?.aborted ? "aborted" : "error";
output.errorMessage = error instanceof Error ? error.message : JSON.stringify(error);
output.errorMessage = formatProviderError(normalizeProviderError(error));
stream.push({ type: "error", reason: output.stopReason, error: output });
stream.end();
}