Fix error

This commit is contained in:
2025-11-13 20:23:57 +01:00
parent e098bdec64
commit 5651f62088
5 changed files with 105 additions and 20 deletions

View File

@@ -124,7 +124,14 @@ export class DesktopFlow {
// Do desktop searches
if (this.bot.config.workers.doDesktopSearch) {
await this.bot.activities.doSearch(workerPage, data)
try {
await this.bot.activities.doSearch(workerPage, data)
} catch (searchError) {
const errorMsg = searchError instanceof Error ? searchError.message : String(searchError)
this.bot.log(false, 'DESKTOP-FLOW', `Desktop search failed: ${errorMsg}`, 'error')
// IMPROVED: Don't throw - continue with other tasks, just log the error
// User will see reduced points but flow completes
}
}
// Fetch points BEFORE closing (avoid page closed reload error)

View File

@@ -136,7 +136,14 @@ export class MobileFlow {
// Go to homepage on worker page
await this.bot.browser.func.goHome(workerPage)
await this.bot.activities.doSearch(workerPage, data)
// IMPROVED: Add error handling for mobile search to prevent flow termination
try {
await this.bot.activities.doSearch(workerPage, data)
} catch (searchError) {
const errorMsg = searchError instanceof Error ? searchError.message : String(searchError)
this.bot.log(true, 'MOBILE-FLOW', `Mobile search failed: ${errorMsg}`, 'error')
// Continue execution - let retry logic handle it below
}
// Fetch current search points
const mobileSearchPoints = (await this.bot.browser.func.getSearchPoints()).mobileSearch?.[0]