From 6c49612fd92e9eb5d4ff751c28a4c0ce62085816 Mon Sep 17 00:00:00 2001 From: rr-bw <102181210+rr-bw@users.noreply.github.com> Date: Wed, 12 Nov 2025 10:42:40 -0800 Subject: [PATCH] address PR feedback: 'Consider error handling in do/while loop' and prevent an infinite loop --- apps/browser/src/popup/app.component.ts | 8 +++++++- apps/desktop/src/app/app.component.ts | 9 +++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/apps/browser/src/popup/app.component.ts b/apps/browser/src/popup/app.component.ts index a0fea35b218..f83fc594205 100644 --- a/apps/browser/src/popup/app.component.ts +++ b/apps/browser/src/popup/app.component.ts @@ -213,7 +213,13 @@ export class AppComponent implements OnInit, OnDestroy { */ do { this.shouldRerunAuthRequestProcessing = false; - await this.processPendingAuthRequests(); + + try { + await this.processPendingAuthRequests(); + } catch (error) { + this.logService.error(`Error processing pending auth requests: ${error}`); + this.shouldRerunAuthRequestProcessing = false; // Reset flag to prevent infinite loop on persistent errors + } // If an "openLoginApproval" message was received while processPendingAuthRequests() was running, then // shouldRerunAuthRequestProcessing will have been set to true } while (this.shouldRerunAuthRequestProcessing); diff --git a/apps/desktop/src/app/app.component.ts b/apps/desktop/src/app/app.component.ts index 1e5b5102722..18a57b38df7 100644 --- a/apps/desktop/src/app/app.component.ts +++ b/apps/desktop/src/app/app.component.ts @@ -521,11 +521,16 @@ export class AppComponent implements OnInit, OnDestroy { */ do { this.shouldRerunAuthRequestProcessing = false; - await this.processPendingAuthRequests(); + + try { + await this.processPendingAuthRequests(); + } catch (error) { + this.logService.error(`Error processing pending auth requests: ${error}`); + this.shouldRerunAuthRequestProcessing = false; // Reset flag to prevent infinite loop on persistent errors + } // If an "openLoginApproval" message was received while processPendingAuthRequests() was running, then // shouldRerunAuthRequestProcessing will have been set to true } while (this.shouldRerunAuthRequestProcessing); - break; case "redrawMenu": await this.updateAppMenu();