Skip to content

Commit c8e327b

Browse files
committed
fix(env): catch dotenv parsing error
1 parent 39d34a4 commit c8e327b

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/config/utils/env.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,12 @@ export async function readLocalEnvFile(flags: {
3131
contentEnvFile = '';
3232
}
3333

34-
const localEnv = dotenv.parse(contentEnvFile);
34+
let localEnv;
35+
try {
36+
localEnv = dotenv.parse(contentEnvFile);
37+
} catch (err) {
38+
throw new Error('Failed to parse .env file');
39+
}
3540

3641
if (flags.loadSystemEnv && typeof flags.env !== 'undefined') {
3742
for (const key of Object.keys(localEnv)) {

0 commit comments

Comments
 (0)