From d8853bb60ff7d3cbd92ee0175bc82839dab83c2e Mon Sep 17 00:00:00 2001 From: mshanemc Date: Thu, 22 Jun 2023 11:45:59 -0400 Subject: [PATCH] fix: tolerate broken auth files (with warning) during readAll --- src/stateAggregator/accessors/orgAccessor.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/stateAggregator/accessors/orgAccessor.ts b/src/stateAggregator/accessors/orgAccessor.ts index c1ae2d3cd7..603577b4a4 100644 --- a/src/stateAggregator/accessors/orgAccessor.ts +++ b/src/stateAggregator/accessors/orgAccessor.ts @@ -16,6 +16,7 @@ import { ConfigFile } from '../../config/configFile'; import { ConfigContents } from '../../config/configStore'; import { Logger } from '../../logger'; import { Messages } from '../../messages'; +import { Lifecycle } from '../../lifecycleEvents'; function chunk(array: T[], chunkSize: number): T[][] { const final = []; @@ -55,8 +56,12 @@ export abstract class BaseOrgAccessor { const username = this.parseUsername(f); - const config = await this.initAuthFile(username); - this.configs.set(username, config); + try { + const config = await this.initAuthFile(username); + this.configs.set(username, config); + } catch (e) { + await Lifecycle.getInstance().emitWarning(`The auth file for ${username} is invalid.`); + } }); // eslint-disable-next-line no-await-in-loop await Promise.all(promises);