Skip to content

Commit

Permalink
fix: warn and throw if config file null
Browse files Browse the repository at this point in the history
  • Loading branch information
rarkins committed Oct 19, 2020
1 parent a8fdb4e commit ff46042
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion lib/workers/repository/init/config.ts
Expand Up @@ -7,7 +7,10 @@ import { configFileNames } from '../../../config/app-strings';
import { decryptConfig } from '../../../config/decrypt';
import { migrateAndValidate } from '../../../config/migrate-validate';
import * as presets from '../../../config/presets';
import { CONFIG_VALIDATION } from '../../../constants/error-messages';
import {
CONFIG_VALIDATION,
REPOSITORY_CHANGED,
} from '../../../constants/error-messages';
import * as npmApi from '../../../datasource/npm';
import { logger } from '../../../logger';
import { readLocalFile } from '../../../util/fs';
Expand Down Expand Up @@ -53,6 +56,11 @@ export async function detectRepoFileConfig(): Promise<RepoFileConfig> {
} else {
let rawFileContents = await readLocalFile(configFileName, 'utf8');
// istanbul ignore if
if (!rawFileContents) {
logger.warn({ configFileName }, 'Null contents when reading config file');
throw new Error(REPOSITORY_CHANGED);
}
// istanbul ignore if
if (!rawFileContents.length) {
rawFileContents = '{}';
}
Expand Down

0 comments on commit ff46042

Please sign in to comment.