Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: use default config when config is empty #1070

Merged
merged 2 commits into from
Nov 18, 2024
Merged

Conversation

shamsartem
Copy link
Collaborator

No description provided.

@MixailE MixailE self-requested a review November 18, 2024 13:00
@@ -320,23 +341,23 @@ async function getLatestConfig<C0, C1, C2, C3, C4, C5, C6, C7, C8, C9>({
actualConfigPath = newConfigPath;
}
} catch {
if (getDefaultConfig === undefined) {
const defaultConfigString = await getDefaultConfigString();
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we avoid the nested try/catch?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

discussed privately that we currently don't know any radically better way to implement this logic

// if config file is empty for some reason - try using default
if (configString.trim() === "") {
dbg(`Config at ${actualConfigPath} is empty. Using default config`);
const defaultConfigString = await getDefaultConfigString();
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The same logic happens in catch

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah. Decided not to move this 3 lines to a separate function or something, arguably it would be less readable in this case

@shamsartem shamsartem merged commit f8e2e29 into main Nov 18, 2024
9 checks passed
@shamsartem shamsartem deleted the use-default-when-empty branch November 18, 2024 14:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants