feat: add timeout error handling for deep research query processing

- Enhanced error logging in deepResearch to detect and log timeout errors specifically.
- Returns empty learnings and URLs on timeout or other errors, allowing graceful recovery.
This commit is contained in:
Ben Nasedkin 2025-02-07 01:49:32 +02:00
parent 6289c740a8
commit 59a8a977cb

View File

@ -207,8 +207,15 @@ export async function deepResearch({
visitedUrls: allUrls,
};
}
} catch (e) {
console.error(`Error running query: ${serpQuery.query}: `, e);
} catch (e: any) {
if (e.message && e.message.includes('Timeout')) {
console.error(
`Timeout error running query: ${serpQuery.query}: `,
e,
);
} else {
console.error(`Error running query: ${serpQuery.query}: `, e);
}
return {
learnings: [],
visitedUrls: [],