Skip to content

Commit

Permalink
fix: make error more informative
Browse files Browse the repository at this point in the history
  • Loading branch information
exKAZUu committed Sep 25, 2023
1 parent b233edd commit f619398
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions packages/shared-lib-node/src/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,8 @@ export function loadEnvironmentVariables(argv: Options, cwd: string): Record<str

if (argv.checkEnv) {
const exampleKeys = Object.keys(config({ path: path.join(cwd, argv.checkEnv) }).parsed || {});
for (const key of exampleKeys) {
if (!(key in envVars)) {
throw new Error(`Missing environment variable: ${key}`);
}
}
const missingKeys = exampleKeys.filter((key) => !(key in envVars));
throw new Error(`Missing environment variables in [${envPaths.join(', ')}]: [${missingKeys.join(', ')}]`);
}
return envVars;
}
Expand Down

0 comments on commit f619398

Please sign in to comment.