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
+2 -1
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();