add detailed error logging for API failures to help debug custom endpoint issues
This commit is contained in:
parent
83c6ac9a2c
commit
e9a1acf546
2 changed files with 14 additions and 2 deletions
|
|
@ -242,7 +242,13 @@ export async function* sendMessageWithCustomHistory(customHistory) {
|
|||
});
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error(`HTTP error! status: ${response.status}`);
|
||||
const errorText = await response.text();
|
||||
console.error("Chat API Error:", {
|
||||
status: response.status,
|
||||
url: apiUrl,
|
||||
response: errorText
|
||||
});
|
||||
throw new Error(`HTTP error! status: ${response.status}: ${errorText}`);
|
||||
}
|
||||
|
||||
const reader = response.body.getReader();
|
||||
|
|
|
|||
|
|
@ -86,7 +86,13 @@ async function* sendMessageWithHistory(messageHistory) {
|
|||
});
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error(`HTTP error! status: ${response.status} from ${apiUrl}`);
|
||||
const errorText = await response.text();
|
||||
console.error("Translation API Error:", {
|
||||
status: response.status,
|
||||
url: apiUrl,
|
||||
response: errorText
|
||||
});
|
||||
throw new Error(`HTTP error! status: ${response.status} from ${apiUrl}: ${errorText}`);
|
||||
}
|
||||
|
||||
const reader = response.body.getReader();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue