Skip to content

Commit

Permalink
fix: tolerate broken auth files (with warning) during readAll
Browse files Browse the repository at this point in the history
  • Loading branch information
mshanemc committed Jun 22, 2023
1 parent fbe375b commit d8853bb
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/stateAggregator/accessors/orgAccessor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<T>(array: T[], chunkSize: number): T[][] {
const final = [];
Expand Down Expand Up @@ -55,8 +56,12 @@ export abstract class BaseOrgAccessor<T extends ConfigFile, P extends ConfigCont
for (const fileChunk of fileChunks) {
const promises = fileChunk.map(async (f) => {
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);
Expand Down

0 comments on commit d8853bb

Please sign in to comment.