improve error msg (#81)

Co-authored-by: apexmfer <apexmfer@gmail.com>
This commit is contained in:
Ethereumdegen 2023-03-22 13:59:14 -04:00 committed by GitHub
parent 79c4ea053f
commit aac8d22707
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -24,7 +24,8 @@ export const OpenAIStream = async (model: OpenAIModel, systemPrompt: string, key
});
if (res.status !== 200) {
throw new Error("OpenAI API returned an error");
const statusText = res.statusText;
throw new Error(`OpenAI API returned an error: ${statusText}`);
}
const encoder = new TextEncoder();