proper error handling

This commit is contained in:
reakjra
2025-12-11 22:00:03 +01:00
parent 70c0adb8e5
commit e874a6a3e0
3 changed files with 28 additions and 2 deletions
@@ -111,6 +111,14 @@ ApiStrategy {
return ({})
}
// Error response handling
if (dataJson.error) {
const errorMsg = `**Error ${dataJson.error.code}**: ${dataJson.error.message}`;
message.rawContent += errorMsg;
message.content += errorMsg;
return { finished: true };
}
// No candidates?
if (!dataJson.candidates) return {};