1
0
mirror of https://github.com/bitwarden/browser synced 2026-02-11 22:13:32 +00:00

address PR feedback: 'Consider error handling in do/while loop' and prevent an infinite loop

This commit is contained in:
rr-bw
2025-11-12 10:42:40 -08:00
parent 4150ad09fa
commit 6c49612fd9
2 changed files with 14 additions and 3 deletions

View File

@@ -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);

View File

@@ -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();