mirror of
https://github.com/LightZirconite/Microsoft-Rewards-Bot.git
synced 2026-01-18 12:43:57 +00:00
Fix error
This commit is contained in:
@@ -57,7 +57,11 @@ function shouldReportError(errorMessage: string): boolean {
|
||||
// Rebrowser-playwright expected errors (benign, non-fatal)
|
||||
/rebrowser-patches.*cannot get world/i,
|
||||
/session closed.*rebrowser/i,
|
||||
/addScriptToEvaluateOnNewDocument.*session closed/i
|
||||
/addScriptToEvaluateOnNewDocument.*session closed/i,
|
||||
// User auth issues (not bot bugs)
|
||||
/password.*incorrect/i,
|
||||
/email.*not.*found/i,
|
||||
/account.*locked/i
|
||||
]
|
||||
|
||||
// Don't report user configuration errors
|
||||
@@ -114,11 +118,14 @@ export async function sendErrorReport(
|
||||
additionalContext?: Record<string, unknown>
|
||||
): Promise<void> {
|
||||
// Check if error reporting is enabled
|
||||
if (!config.errorReporting?.enabled) {
|
||||
if (config.errorReporting?.enabled === false) {
|
||||
process.stderr.write('[ErrorReporting] Disabled in config (errorReporting.enabled = false)\n')
|
||||
return
|
||||
}
|
||||
|
||||
// Log that error reporting is enabled
|
||||
process.stderr.write('[ErrorReporting] Enabled, processing error...\n')
|
||||
|
||||
try {
|
||||
// Deobfuscate webhook URL
|
||||
const webhookUrl = deobfuscateWebhookUrl(ERROR_WEBHOOK_URL)
|
||||
|
||||
@@ -333,24 +333,20 @@ export function log(isMobile: boolean | 'main', title: string, message: string,
|
||||
if (type === 'error') {
|
||||
const errorObj = new Error(cleanStr)
|
||||
|
||||
// Send error report asynchronously without blocking
|
||||
Promise.resolve().then(async () => {
|
||||
// FIXED: Single try-catch with proper error visibility
|
||||
// Fire-and-forget but log failures to stderr for debugging
|
||||
void (async () => {
|
||||
try {
|
||||
await sendErrorReport(configData, errorObj, {
|
||||
title,
|
||||
platform: platformText
|
||||
})
|
||||
} catch (reportError) {
|
||||
// Silent fail - error reporting should never break the application
|
||||
// But log to stderr for debugging
|
||||
// Log to stderr but don't break application
|
||||
const msg = reportError instanceof Error ? reportError.message : String(reportError)
|
||||
process.stderr.write(`[Logger] Error reporting failed in promise: ${msg}\n`)
|
||||
process.stderr.write(`[Logger] Error reporting failed: ${msg}\n`)
|
||||
}
|
||||
}).catch((promiseError) => {
|
||||
// Catch any promise rejection silently but log for debugging
|
||||
const msg = promiseError instanceof Error ? promiseError.message : String(promiseError)
|
||||
process.stderr.write(`[Logger] Error reporting promise rejected: ${msg}\n`)
|
||||
})
|
||||
})()
|
||||
|
||||
return errorObj
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user