add detailed error logging for API failures to help debug custom endpoint issues

This commit is contained in:
Russell Ballestrini 2025-07-10 23:52:25 -04:00
parent 83c6ac9a2c
commit e9a1acf546
2 changed files with 14 additions and 2 deletions

View file

@ -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();

View file

@ -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();