Skip to content

Commit 64cf0a0

Browse files
committed
Improve custom API error handling
1 parent 2f40cd2 commit 64cf0a0

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/api/Providers/special/custom_openai.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,12 @@ export const CustomOpenAIProvider = {
105105
{ timeout: 0 } // disable timeout
106106
);
107107

108+
if (!response.ok) {
109+
const errorText = await response.text();
110+
yield `Error: ${response.status} ${response.statusText}\n${errorText}`;
111+
return;
112+
}
113+
108114
const reader = response.body;
109115
let buffer = "";
110116

0 commit comments

Comments
 (0)