mirror of
https://github.com/LightZirconite/Microsoft-Rewards-Bot.git
synced 2026-01-20 13:43:56 +00:00
Fix error
This commit is contained in:
@@ -28,7 +28,14 @@ export class Search extends Workers {
|
||||
public async doSearch(page: Page, data: DashboardData) {
|
||||
this.bot.log(this.bot.isMobile, 'SEARCH-BING', 'Starting Bing searches')
|
||||
|
||||
page = await this.bot.browser.utils.getLatestTab(page)
|
||||
// IMPROVED: Add error handling for getLatestTab to prevent early flow failure
|
||||
try {
|
||||
page = await this.bot.browser.utils.getLatestTab(page)
|
||||
} catch (error) {
|
||||
const errorMsg = error instanceof Error ? error.message : String(error)
|
||||
this.bot.log(this.bot.isMobile, 'SEARCH-BING', `Failed to get latest tab: ${errorMsg}`, 'error')
|
||||
throw new Error(`Cannot start search - tab retrieval failed: ${errorMsg}`)
|
||||
}
|
||||
|
||||
let searchCounters: Counters = await this.bot.browser.func.getSearchPoints()
|
||||
let missingPoints = this.calculatePoints(searchCounters)
|
||||
|
||||
Reference in New Issue
Block a user