diff --git a/legacy/src/fetch-sse.ts b/legacy/src/fetch-sse.ts index 00410eb6..c49f6552 100644 --- a/legacy/src/fetch-sse.ts +++ b/legacy/src/fetch-sse.ts @@ -12,7 +12,8 @@ export async function fetchSSE( const { onMessage, ...fetchOptions } = options const res = await fetch(url, fetchOptions) if (!res.ok) { - const msg = `ChatGPT error ${res.status || res.statusText}` + const reason = await res.text() + const msg = `ChatGPT error ${res.status || res.statusText}: ${reason}` const error = new types.ChatGPTError(msg, { cause: res }) error.statusCode = res.status error.statusText = res.statusText